2
var vehiclePage = (function(){
// defined these 3 public variable. to share between zoomNoShowFee & submitVehicle
this.obj;
this.rate;
this.idx;
var setPara = function(o,t,i){
this.obj = o;
this.rate = t;
this.idx = i;
}
return {
zoomNoShowFee : function(o,t,i){
// this is existing function. I need to access o,t,i inside submitVehicle function.
setPara(o,t,i); // wrote this private function to set values
},
submitVehicle : function(){
// here I need to access zommNoShowFee's parameter
alert(this.rate);
}
} // return
})();
vehiclePage.zoomNoShowFee(null,5,3);
vehiclePage.submitVehicle(); // getting undefined
zoomNoShowFee已经存在。其他一些开发人员写了这个。我想使用submitVehicle中传递给zoomNoShowFee参数的值。从javascript中访问另一个函数的参数
为此,我在顶部声明了3个公共变量,并尝试使用setPara专用函数存储值。这样我就可以访问submitVehicle函数内部的那些公共变量。
但得到未定义调用vehhiclePage.submitVehilce时()
从根本上说,我做错了什么。但不知道在哪里...
感谢您的帮助......