<script language="JavaScript" type="text/javascript">
<!--
var obj={};                          //定义了一个空对象
var user={
name:"jack",              //定义了 name 属性,初始化为 jack
favoriteColor:["red","green","black","white"],//定义了颜色喜好数组
hello:function(){         //定义了方法 hello
alert("hello,"+this.name);
},
sex:"male"                 //定义了性别属性 sex,初始化为 sex
}


//调用 user 对象的方法 hello
user.hello();
//-->
</script>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2021-11-30
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2022-03-09
  • 2022-01-10
相关资源
相似解决方案