• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
龙星之峰
抓住时间,改变现状
博客园    首页    新随笔    联系   管理    订阅  订阅

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>

 

变量的内容在脚本执行期间是可以改变的,你可以在命名的时候,用一个有意义的名字来做为变量名字,以便你自己区别,或者方便别人来区别变量的作用,

posted @ 2007-01-21 11:06  lxsohu  阅读(186)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3