声明一个变量,为它赋值,然后显示出来
- <html>
- <body>
- <script type="text/javascript">
- var firstname;
- firstname="George";
- document.write(firstname);
- document.write("<br />");
- firstname="John";
- document.write(firstname);
- </script>
- <p>上面的脚本声明了一个变量,为其赋值,显示该值,改变该值,然后再显示该值。</p>
- </body>
- </html>