function ajax(){}ajax.prototype={
//ajax内部代码.用到了this
}
function myfunction(){}
myfunction.prototype={
//自定义的函数.这里面要用到ajax请求.
(new ajax).get(...)
}
现在的问题是这样的.
单独调用ajax的时候,就是对的.
但是如果是在myfunction中调用的时候,就不行了.因为this指向了myfunction如何才能避免这个问题?
//ajax内部代码.用到了this
}
function myfunction(){}
myfunction.prototype={
//自定义的函数.这里面要用到ajax请求.
(new ajax).get(...)
}
现在的问题是这样的.
单独调用ajax的时候,就是对的.
但是如果是在myfunction中调用的时候,就不行了.因为this指向了myfunction如何才能避免这个问题?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货