声明一个变量,为它赋值,然后显示出来

  1. <html>
  2. <body>
  3.  
  4. <script type="text/javascript">
  5. var firstname;
  6. firstname="George";
  7. document.write(firstname);
  8. document.write("<br />");
  9. firstname="John";
  10. document.write(firstname);
  11. </script>
  12.  
  13. <p>上面的脚本声明了一个变量,为其赋值,显示该值,改变该值,然后再显示该值。</p>
  14.  
  15. </body>
  16. </html>