请指教:prototype.js ajax里面onSuccess 里面调用 公有成员函数的问题
1
var Person = Class.create();
2
Person.prototype ={
3
initialize:function(){
4
this.name="BOY";
5
},
6
GetName:function(){
7
alert(this.name);
8
},
9
AjaxQuestion:function(){
10
var option={
11
method:"get",
12
parameters:"",
13
onSuccess:function(transport){
14
alert("hello1");
15
this.GetName(); // 这里没反应
16
alert("hell02");
17
},
18
onFailure:function(transport){
19
alert("Failure");
20
}
21
}
22
var request= new Ajax.Request("ajax.aspx",option);
23
}
24
}
25
// 调用
26
var ps = new Person();
27
ps.GetName();
28
ps.AjaxQuestion();
var Person = Class.create();2
Person.prototype ={3
initialize:function(){4
this.name="BOY";5
},6
GetName:function(){7
alert(this.name);8
},9
AjaxQuestion:function(){10
var option={11
method:"get",12
parameters:"",13
onSuccess:function(transport){ 14
alert("hello1"); 15
this.GetName(); // 这里没反应 16
alert("hell02");17
},18
onFailure:function(transport){19
alert("Failure");20
}21
}22
var request= new Ajax.Request("ajax.aspx",option);23
}24
}25
// 调用26
var ps = new Person();27
ps.GetName();28
ps.AjaxQuestion();

Person.prototype 
initialize:
浙公网安备 33010602011771号