上面的程序怎么会不成功呢?
你不是都直接赋值了吗?
<?
  $a="999";
  echo "<script language='javascript'>";
  echo "document.write(".$a.");";
  echo "</script>";
?>
这样试试,保险些。