JS 关于this的一点疑问 请指教!
时间:2011-08-29
来源:互联网
window.onload=function(){
MyIEL_Editor=new IEL_Editor("MyIEL_Editor");
}
IEL_Editor.prototype.prepareSubmit = function (){
if (!oLinkField) {return;}
var oForm = oLinkField.form;
if (!oForm) {return;}
if(this.isMSIE()){
oForm.attachEvent("onsubmit", this.AttachSubmit);
}else{
oForm.addEventListener("submit", this.AttachSubmit);
}
}
IEL_Editor.prototype.AttachSubmit = function (){
try{
if (!oLinkField) {return false;}
var oForm = oLinkField.form;
if (!oForm) {return false;}
if(MyIEL_Editor.sCurrMode == "CODE"){
MyIEL_Editor.toggleMode("EDIT");
}
return true;
}catch(err){
alert("错误:" + err.description);
return false;
}
}
怎么样才能把 IEL_Editor.prototype.AttachSubmit 函数中的MyIEL_Editor替换成this
因为直接用this.sCurrMode返回的是undefined
MyIEL_Editor=new IEL_Editor("MyIEL_Editor");
}
IEL_Editor.prototype.prepareSubmit = function (){
if (!oLinkField) {return;}
var oForm = oLinkField.form;
if (!oForm) {return;}
if(this.isMSIE()){
oForm.attachEvent("onsubmit", this.AttachSubmit);
}else{
oForm.addEventListener("submit", this.AttachSubmit);
}
}
IEL_Editor.prototype.AttachSubmit = function (){
try{
if (!oLinkField) {return false;}
var oForm = oLinkField.form;
if (!oForm) {return false;}
if(MyIEL_Editor.sCurrMode == "CODE"){
MyIEL_Editor.toggleMode("EDIT");
}
return true;
}catch(err){
alert("错误:" + err.description);
return false;
}
}
怎么样才能把 IEL_Editor.prototype.AttachSubmit 函数中的MyIEL_Editor替换成this
因为直接用this.sCurrMode返回的是undefined
作者: dabpop139 发布时间: 2011-08-29
没人可以帮忙指点一下吗!!没人可以帮忙指点一下吗!!没人可以帮忙指点一下吗!!
作者: dabpop139 发布时间: 2011-08-31
人家函数里面根本没用this你怎么替换,如果非要替换你就CTRL+F把里面的代码改成this好了
作者: sophiasmth 发布时间: 2011-08-31
少了个函数
作者: lifeseato 发布时间: 2011-08-31
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28