0
这个怎么回事—变量foo
怎么没有从onModified()
的Document
对象中定义?JavaScript示波器和面向对象
function Document() {
var foo = "dfsadf";
this.onModified = function() {
alert(foo);
};
}
// Does not alert; "foo" doesn't resolve
new Document().onModified();
我想对Document
引用是莫名其妙私有Document
变量公共方法。
你确定吗?这应该提醒''dfsadf''。 – 2010-11-20 20:46:01
它适合我。 – jwueller 2010-11-20 20:46:38
你正在Firefox上测试,不是吗? :) – CMS 2010-11-20 20:48:52