<html>
<head>
<script>
window.onload = function () {
new Click("btn");
};
function Click(id) {
var _this = this;
this.oBtn = document.getElementById(id);
this.oBtn.onclick = function () {
_this.sayHello();
};
}
Click.prototype.sayHello = function () {
alert("Hello World!");
};
</script>
</head>
<body>
<input id="btn" type="button" value="button" />
</body>
</html>
问题是实例化对象后即new Click("btn")之后,构造函数中的私有静态变量_this是如何取到的?
慕田峪9158850
芜湖不芜
MYYA
慕桂英3389331
明月笑刀无情
相关分类