A = Class.create();
A.prototype={
initialize: function(){
...
//把参数放到这里
A.prototype.onclick=B.bindAsEventListener(this); }
B: function(){
//参数
}
}
A.prototype={
initialize: function(){
...
//把参数放到这里
A.prototype.onclick=B.bindAsEventListener(this); }
B: function(){
//参数
}
}
是
A = Class.create();
A.prototype={
initialize: function(){
...
//把参数放到这里
this.onclick=this.B.bindAsEventListener(this); }
B: function(){
//参数
}
}
A.prototype={
initialize: function(anId){
this.element = $("anId");
//把参数放到这里
this.element.onclick=this.B.bindAsEventListener(this); }
B: function(){
//参数
}
}
我所遇到问题的代码是这样的
function sendRequest(_menu,url){
var xmlHTTPRequestObj;
xmlHTTPRequestObj = buildXmlHttpRequest();
if(!xmlHTTPRequestObj){
return;
}
alert(xmlHTTPRequestObj.readyState);
menu = _menu;
xmlHTTPRequestObj.onreadystatechange = proessRequest;
proessRequest.xmlHTTPRequestObj = xmlHTTPRequestObj;
xmlHTTPRequestObj.open("GET",url,true);
xmlHTTPRequestObj.send(null);
}//回调函数
function proessRequest(){
if(xmlHTTPRequestObj.readyState == STATEDONE){
if(xmlHTTPRequestObj.status == STATUSSUCCESS){
alert(xmlHTTPRequestObj.responseText);
if(xmlHTTPRequestObj.responseText){
appendChildElement(xmlHTTPRequestObj.responseText);
divshow(menu);
}
}
}
}xmlHTTPRequestObj.onreadystatechange = proessRequest;
这句指定了响应时的回调函数,我想让proessRequest()方法里的xmlHTTPRequestObj是sendRequest所传递过来的,请大虾做进一步解释,谢谢