xyzzy ha scritto:
> You have to realize what is going on - on the server.
> PHP is processed BEFORE rendering HTML pages to the client (browser)
> JavaScript is executed AFTER this by the client.
> So, any PHP output that you send will be created inside of the HTML
> stream and sent to the browser.
>
> So,
>
> Something like this
> # file test.php
> <html>
> <body>
> <?php
> echo "<script language='javascript'>";
> echo "alert ("Hello World");";
> echo "</script>";
>>
> </body>
> </html>
You might want to do:
<html>
<body>
<?php
echo '<script language="javascript">
alert ("Hello World");
</script>';
?>
</body>
</html>
Take a look at quotes, especially (" => ' if there are not variable or
things like \n to parse).
> is seen by the browser as
>
> <html>
> <body>
> <script language='javascript'>
> alert ("Hello World");
> </script>
> </body>
> </html>
>
> The browser has no clue that PHP rendered the page, nor does it care.
> It will just display the page and the alert.
A.
--
My homepage
http://antoniobonanno.debris.it/
My portfolios
http://www.debris.it/whois.php?i=6
http://www.usefilm.com/photographer/19053.html
http://www.photosig.com/go/users/view?id=99395