You're trying to embed a server based language in a client-side based language.
This will not work.
If you could explain a bit more what it is you're trying to achieve there might be a better solution, like AJAXie type thing.
Let me explain a bit more as others have given answers that could be put here.
You can have php
embedded inside your *.php files which will be interpretted on the server and parsed there. Using this you can set variables which javascript could pick up on later and use on the client-side. Like I said though the client side doesn't have a route for intpretting and parsing php
and so sending php
across to the user is not going to work.
If you are however trying to get things working so that your php sets some javascript values then I would, like Gary Willough and Tudor Olariu both say, add the php tags
<?php
... PHP CODE...
?>
However, you have to realise this will be interpretted on the server and not on the client. Therefore the following code would alert with "outside php" and then "inside php".
<script language="JavaScript">
function fonsubmit()
{
alert('outside php');
<?php
$message = "inside php";
echo "alert('$message');";
?>
}
</script>
The html sent to the user would then be
<script language="JavaScript">
function fonsubmit()
{
alert('outside php');
alert('inside php');
}
</script>
Hope this helps.