You are here: Re: DOM doc - simple find element PHP+JS « PHP Programming Language « IT news, forums, messages
Re: DOM doc - simple find element PHP+JS

Posted by Ian Collins on 01/19/06 10:16

one man army wrote:
>
> hmmm, that is the Javascript part. Perhaps I will expand on this..
>
> * I have a very simple HTML page, with a FORM, with an INPUT TEXT
> * there is a button that activates some javascript
> * the javascript causes this to happen
>
> // Create new JS element
> var jsel = document.createElement('SCRIPT');
> jsel.type = 'text/javascript';
> jsel.src = url;
>
> // Append JS element (therefore executing the the PHP call)
> document.body.appendChild (jsel);
>
> url points to a PHP file! the appendChild has the effect of causing the
> script to be executed. Apparently the broswer thinks it is Javascript,
> so the javascript in it runs, but the suffix is .php, so the server sees
> it , and the PHP runs. Really, it works.
>
It thinks it's JavaScript because you tell it it is...

The PHP script runs when you open the page.

So your browser's JavaScript interpreter attempts to run the output from
the PHP.

Bit of a mess.

--
Ian Collins.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация