日期:2014-05-16 浏览次数:20461 次
window.onload = function() {
function Base() {
this.elements = [];
}
Base.prototype.getId = function(id) {
this.elements.push(document.getElementById('a'));
alert(this); //这行的this
};
Base.getId('a');
};
window.onload = function() {
function Base() {
this.elements = [];
}
Base.prototype.getId = function(id) {
this.elements.push(document.getElementById('a'));
alert(this); //这行的this
};
var base = new Base();
base.getId('a');
};
function test() {
console.log(this.x);
}
var o = {};
o.x = 1;
o.m = test;
o.m();
test();