PDA

For continued disscussion on this topic : Calling JavaScript inside PHP tags



George W. Bush
06-01-2001, 04:57 AM
How would one call some JavaScript inside the <? and ?> tags used in PHP? Is this possible?

Thejavaman1
06-01-2001, 05:12 AM
echo "<script>
//your javascript here...
</script>";

lorddog
06-01-2001, 01:34 PM
hey bush you have to remmember that php will make your page on the server.
and then the javascript will be executed on the client's machine.

if you wish to dynamically create your javascript or some variable
values in it then php works great, but just remmember they
don't execute at the same time.

(you probably knew all that anyways)
Lorddog

George W. Bush
06-01-2001, 02:00 PM
Uh huh. Yes, of course doggy man.

:haha:

George W. Bush
06-15-2001, 05:54 AM
All right... now, if I were to use an external JavaScript within the <? ?> tags of PHP, would I have to reffer to a JavaScript in the following format:

echo "<SCRIPT SRC="javascript.js"></SCRIPT>";

lorddog
06-15-2001, 12:37 PM
well you can't have " outside and inside so try these methods
in php one of them should work

echo "<SCRIPT SRC='javascript_file.js'></SCRIPT>";

echo "<SCRIPT SRC=\"javascript_file.js\"></SCRIPT>";

?><SCRIPT SRC="javascript_file.js"></SCRIPT><?

where javascript_file.js is the file name

Lorddog