you can do it in following way....
<%php
$message = "Hello world!";
%>
<script language="Javascript">
alert("<?=$message?>");
</script>
the theory is that, php will be executed on the server and alert("<?=$message?>"); will be converted into alert("Hello world!");
Best regards
fadee