M Meesh P Guest Nov 2, 2009 #1 I have a code that start with <script language="javascript"> how and where do I add it in a .php file?
I have a code that start with <script language="javascript"> how and where do I add it in a .php file?
C Coed Naked New member Nov 2, 2009 #2 PHP is a language and inside of the PHP tags <?php you probably see something like echo "<html>"; to add javascript inside of php use the same echo statements echo "<script language=\"javascript\">\n"; echo "alert('Hello!!');\n"; echo "</script>\n" Whatever you echo is what a "browser" would see as HTML markup etc. I find it is much easier to use " for echo since javascript likes ' also allows you to use variables and the \n .
PHP is a language and inside of the PHP tags <?php you probably see something like echo "<html>"; to add javascript inside of php use the same echo statements echo "<script language=\"javascript\">\n"; echo "alert('Hello!!');\n"; echo "</script>\n" Whatever you echo is what a "browser" would see as HTML markup etc. I find it is much easier to use " for echo since javascript likes ' also allows you to use variables and the \n .
J Jeff P New member Nov 2, 2009 #3 Anywhere you want, just as long as it's not inside php tags, ie: <?php ... ?> <script language="javascript"> var i =1; </script> <?php .... ?>
Anywhere you want, just as long as it's not inside php tags, ie: <?php ... ?> <script language="javascript"> var i =1; </script> <?php .... ?>