Es sencillo, simplemente es hacer la asignación respetando la sintaxis de JavaScript. El siguiente ejemplo lo ilustra de una forma sencilla:
<?php
|
echo '<head>
|
<title>'.$_SERVER[PHP_SELF].'</title>
|
</head>
|
<html>
|
<body>';
$variable_php="variable en php";
echo '<script languaje="JavaScript">
|
var varjs="'.$variable_php.'";
|
alert(varjs);
|
</script>';
echo "<a href=$_SERVER[PHP_SELF]>Recargar la Página</a>";
|
echo '</body>
|
</html>';
?>
|