Page 1 of 1

php calling javascript function help

Posted: Fri Dec 10, 2010 3:09 am
by tinks
hi, how do i call a javascript function from a separate file from my php file? I do it like this but aint working...

php file (different file)
---------------------
<?php
echo "<script language='javascript' src='myJS.js>funcA();</script>";
?>
-----------------------


myJS.js (different file)
------------------------
function funcA(){
..some code..
}

-----------------------

thanks so much pretty need this to work :(

note: these two are in separate files..


thank a lot,
tinks

Re: php calling javascript function help

Posted: Fri Dec 10, 2010 10:44 am
by Celauran
tinks wrote:hi, how do i call a javascript function from a separate file from my php file? I do it like this but aint working...

php file (different file)

Code: Select all

echo "<script language='javascript' src='myJS.js>funcA();</script>";

Code: Select all

echo "<script type='text/javascript' src='myJS.js'></script>";
echo "<script type='text/javascript'>funcA();</script>";