JavaScript学习与实践(4)
JS变量,
变量是一个你要存储信息的容器。
例子:
<html>
<body>
<script type="text/javascript">
var name = "Hege"
document.write(name)
document.write("<h1>"+name+"</h1>")
</script>
<p>This example declares a variable, assigns a value to it, and then displays the variable.</p>
<p>Then the variable is displayed one more time, only this time as a heading.</p>
</body>
</html>
变量的内容在脚本执行期间是可以改变的,你可以在命名的时候,用一个有意义的名字来做为变量名字,以便你自己区别,或者方便别人来区别变量的作用,
浙公网安备 33010602011771号