How can I call a javascript function from php?

  • Thread starter Thread starter hughmanwho
  • Start date Start date
H

hughmanwho

Guest
I need to use php to determine whether or not to call the function and to pass it arguments. This is what I tried:
php:
echo "<Script language='javascript'>";
echo "youwin(".count.");";
echo "</Script>";

The javascript function is:
function youwin(num)
{
alert("You win!! You are the "+num+"th winner");
return true;
}

For some reason the javascript function is not being executed. Any advice?
Thanks!
 
Back
Top