Posted by macca on 12/23/07 19:27
On Dec 23, 1:43 pm, Jonas Werres <jo...@example.org> wrote:
> > Or save a file named myscript.js.php. In the file you can use both
> > javascript and php. For example, you can write:
>
> > alert( <?php 12 + 15 ?> )
>
> > and then include it in your html with:
>
> > <script type="text/javascript" language="JavaScript"
> > src="myscript.js.php"></script>
Its still the same thing. The PHP is interpreted on the server before
the javascript on the client,
so, what is sent to the client is actually
alert(27)
it's the same as having a file called script.php and writing
<script language="javascript" type="text/javascript">
alert(<?php echo 12 + 15; ?>)
</script>
[Back to original message]
|