..oO(jsteinmann)
Quote:
hmmmmm......
can you give me an example? |
Like you can use PHP to output HTML, you can also use it to generate JS.
There's not much of a difference. If the script is embedded in the HTML
with a 'script' element like in your case, it's particularly easy. Here
is a short example:
http://www.alt-php-faq.org/local/33/
Of course the entire page has to be passed through PHP, usually by
simply giving it a .php extension. Whether the embedded PHP outputs
some HTML or JS doesn't really matter from the browser's point of view.
Here's a more advanced example of using PHP in an external JS file:
http://javascriptkit.com/javatutors/externalphp.shtml
The key point in both is that PHP is used to write JS statements, which
are then interpreted by the browser.
For more informations and examples try a Google search for keywords like
"generate javascript with php"
Micha