div.disabled is not working in Chrome or Firefox
我有以下JavaScript,可以在Internet Explorer(IE)中正常工作
1 2 3 4 5 6 7 8 9 10 | function disableDiv() { disablebutton(document.getElementById("pageWidth")) } function disablebutton(el) { try { el.disabled = el.disabled ? false : true; } catch (E) { } } |
我在JavaScript函数中称呼它
1 2 3 4 5 6 | function updatediv() { if (document.getElementById("sbtotals") != null) { document.getElementById("sbtotals").style.display ="none"; } disableDiv(); } |
在IE
我应该怎么做才能在所有3种浏览器中正常工作?
不能禁用Divs。 仅形式和形式要素
您不能"禁用" div。 相反,您可以将其CSS显示属性设置为"无"。