Javascript .函数闭包中不允许使用原型?
返回未捕获的语法错误:意外标记 这不是闭包,而是对象声明。无法访问JS对象内部的xml属性。你必须这样做Javascript .函数闭包中不允许使用原型?,javascript,prototype,Javascript,Prototype,返回未捕获的语法错误:意外标记 这不是闭包,而是对象声明。无法访问JS对象内部的xml属性。你必须这样做 JS = { xml : function() { if(window.XMLHttpRequest) { this.http = new window.XMLHttpRequest(); } }, xml.prototype.ajax : function() { alert(this.http);
JS = {
xml : function() {
if(window.XMLHttpRequest) {
this.http = new window.XMLHttpRequest();
}
},
xml.prototype.ajax : function() {
alert(this.http);
}
}
你能添加语言标签吗?
JS = {
xml : function() {
if(window.XMLHttpRequest) {
this.http = new window.XMLHttpRequest();
}
},
}
JS.xml.prototype.ajax = function() {
alert(this.http);
}