php calling javascript function help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tinks
Forum Newbie
Posts: 5
Joined: Mon Oct 18, 2010 2:32 am

php calling javascript function help

Post 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
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: php calling javascript function help

Post 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>";
Post Reply