部分代码如下:
if(document.uniqueID)//IE浏览器
{
cell1.style.cssText = "width:10px;";
cell1.setAttribute("align","center");
cell2.style.cssText = "width:260px;";
}
else//其他浏览器
{
cell1.setAttribute("style","width:10px;");
cell1.setAttribute("align","center");
cell2.setAttribute("style","width:260px;");
}
row.appendChild(cell1);
row.appendChild(cell2);
document.getElementById(controlId).appendChild(row);在IE下没有问题,在FF下就宽度就变了,到底什么原因?
if(document.uniqueID)//IE浏览器
{
cell1.style.cssText = "width:10px;";
cell1.setAttribute("align","center");
cell2.style.cssText = "width:260px;";
}
else//其他浏览器
{
cell1.setAttribute("style","width:10px;");
cell1.setAttribute("align","center");
cell2.setAttribute("style","width:260px;");
}
row.appendChild(cell1);
row.appendChild(cell2);
document.getElementById(controlId).appendChild(row);在IE下没有问题,在FF下就宽度就变了,到底什么原因?
IE都能识别*,标准浏览器(如FF)不能识别*;
IE6能识别*,但不能识别 !important;
IE7能识别*,也能识别 !important;
FF不能识别*,但能识别 !important;
例如style="*width:10px;width:20px;"
这样在IE下宽度为10px,在ff下宽度时20px