我试图使用 document.getElementById("my_id") 来获取 DOM 的句柄,但无法做到。 我的代码流程有两个阶段: 第一阶段(有效):
document.getElementById("my_text_field").style.visibility = "hidden";
或
document.getElementById("my_text_field").style.display= "none";
我不知道上面哪一个会被执行。
第 2 阶段(不起作用):
document.getElementById("my_text_field").style.visibility = "visible";
或
document.getElementById("my_text_field").style.display = "table-row";
这两个阶段在 Firefox 3.6 中都运行良好(我必须使用 3.6)。 但似乎在第 1 阶段,DOM 变得隐藏/不可见,因此 IE8 无法使用 document.getElementById() 找到它们。
请指教。
谢谢。
最佳答案
也许问题是table-row
support in IE :
The values "inline-table", "run-in", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-row", "table-row-group", and "inherit" is not supported in IE7 and earlier. IE8 requires a !DOCTYPE. IE9 supports the values.
关于javascript - 在 IE8 中无法使用 document.getElementById 找到 DOM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8251616/