日期:2014-05-17  浏览次数:20971 次

IE和Firefox兼容性问题
function bindGCComboxObject() {
var inputObjs = document.getElementsByTagName("input");
bsGCComboxContain();

for(var i=0;i<inputObjs.length;i++){
if (inputObjs[i].type == "text" && inputObjs[i].getAttribute("isGCCombox")=="yes"){
var tmpEle = inputObjs[i];
var formObj=null;
var formObjReadOnly=0;

while (tmpEle.tagName.toUpperCase()!="HTML") {
if (tmpEle.tagName.toUpperCase()=="FORM") {
formObj=tmpEle;
break;
}
tmpEle=tmpEle.parentElement;
}

var bindParam=inputObjs[i].getAttribute("bindParam");

if (bindParam == null || bindParam == "undefined")
{
continue;
}

var bindParamArr=bindParam.split("|");

var bindPostUrl=bindParamArr[0];

if (bindParamArr.length>1 && bindParamArr[1]!="") var bindRelationObj=bindParamArr[1];
else var bindRelationObj=null;

if (bindParamArr.length>2 && bindParamArr[2]!="") var bindEvent=bindParamArr[2];
else var bindEvent=null;

if (formObj!=null) {
var hideInputObj=document.createElement("INPUT");
hideInputObj.style.visibility="hidden";
hideInputObj.id=inputObjs[i].id+"_ComboxSelect";
hideInputObj.name=inputObjs[i].name+"_ComboxSelect";

formObj.appendChild(hideInputObj);
/*
if (inputObjs[i].getAttribute("defaultSelect")!=null && inputObjs[i].getAttribute("defaultSelect")!="") {
hideInputObj.value=inputObjs[i].getAttribute("defaultSelect");
if (bindEvent!=null) eval(bindEvent);
}
*/

if (inputObjs[i].getAttribute("forceSelect")=="1") {
formObjReadOnly=1;
}

}

new bsGCCombox({gccomboxID: inputObjs[i].id,gcpostUrl: bindPostUrl,gcrelationObj: bindRelationObj,gcevent:bindEvent,gcforceSelect:formObjReadOnly});


}
}
}




其中在火狐下老是提示tmpEle is undefined ,我想知道我的方法哪个地方让火狐不兼容了?

------解决方案--------------------
firebug 调试一下

看代码,没发现问题