欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!
this 关键词
 
在函数定义中,this 引用该函数的“拥有者”。
 
在上面的例子中,this 指的是“拥有” fullName 函数的 person 对象。
 
换言之,this.firstName 的意思是 this 对象的 firstName 属性。
 
请在 JS this 关键词这一章学习更多有关 this 关键词的知识。
 
对象定义
 
我们定义(创建)了一个 JavaScript 对象:
 
实例
 
var person = {firstName:"Bill", lastName:"Gates", age:62, eyeColor:"blue"};
 
空格和折行都是允许的。对象定义可横跨多行:
 
实例
 
var person = {
 
    firstName:"Bill",
 
    lastName:"Gates",
 
    age:50,
 
    eyeColor:"blue"
 
};

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/html/h64404.shtml