IE6与IE7下一点样式的区别
function OpenSendNote(strMobileTel,strName,theThis)
{
document.all.txtMobileTel.value=strMobileTel;
document.all.txtMsg_Content.value="请输入短信内容";
document.all.txtReserve.value="";
document.all.txtName.value=strName;
document.all.tbSendNote.style.visibility="visible";
var intY=theThis.offsetTop;
var objTmp=theThis.offsetParent;
for(i=0;i<100;i++ )
{
intY=intY+(objTmp.offsetTop);
objTmp=objTmp.offsetParent;
if(objTmp==window.document.body){break;}
i++;
}
document.getElementById("tbSendNote").style.top=intY;
//var topY = intY +'px';
//document.getElementById("tbSendNote").style.top=topY;
}
这是一断发送短信对话框的脚本,在IE7下这段脚本是没有问题的,但在IE6下会报错,让你调试,无法打开那个发送短信对话框,原因在倒数第三行。document.getElementById("tbSendNote").style.top=intY; 在IE7下默认是对intY加了‘PX’的,所以能正常运行。但为了兼容IE6,你需要把这行,改为下面注释的两行。即document.getElementById("tbSendNote").style.top=intY;换成var topY = intY +'px';
document.getElementById("tbSendNote").style.top=topY;
{
document.all.txtMobileTel.value=strMobileTel;
document.all.txtMsg_Content.value="请输入短信内容";
document.all.txtReserve.value="";
document.all.txtName.value=strName;
document.all.tbSendNote.style.visibility="visible";
var intY=theThis.offsetTop;
var objTmp=theThis.offsetParent;
for(i=0;i<100;i++ )
{
intY=intY+(objTmp.offsetTop);
objTmp=objTmp.offsetParent;
if(objTmp==window.document.body){break;}
i++;
}
document.getElementById("tbSendNote").style.top=intY;
//var topY = intY +'px';
//document.getElementById("tbSendNote").style.top=topY;
}
这是一断发送短信对话框的脚本,在IE7下这段脚本是没有问题的,但在IE6下会报错,让你调试,无法打开那个发送短信对话框,原因在倒数第三行。document.getElementById("tbSendNote").style.top=intY; 在IE7下默认是对intY加了‘PX’的,所以能正常运行。但为了兼容IE6,你需要把这行,改为下面注释的两行。即document.getElementById("tbSendNote").style.top=intY;换成var topY = intY +'px';
document.getElementById("tbSendNote").style.top=topY;