<html>
<body>
<h1>JavaScript <b>this</b> 关键词</h1>
<p>在本例中,<b>this</b> 代表“拥有” fullName 方法的 person 对象。</p>
<p id="demo"></p>
<script>
// 创建对象:
var person = {
firstName : "Bill",
lastName : "Gates",
id : 678,
myFunction : function() {
return this;
}
};
// 显示来自对象的数据:
document.getElementById("demo").innerHTML = person.myFunction();
</script>
</body>
</html>