Home >Web Front-end >JS Tutorial >A bug in js hiding select through css under IE6_form effects

A bug in js hiding select through css under IE6_form effects

WBOY
WBOYOriginal
2016-05-16 18:21:121180browse

I encountered a problem today. When hiding table row Tr,
$id("tr_" id "_1").style.setAttribute('cssText',"display:none;");,
table row Tr The select inside cannot be hidden in IE6 and will still be displayed on the page. I want to set the select style separately to hide
$id("new_attpm_id2_" id).style.setAttribute('cssText',"display:none;");
cannot be hidden either. I searched online and found the article "Under IE6 , a bug in js hiding select through css. It turns out that this is a bug in IE6, and it can be hidden through style.display = "none";
The final code is as follows $id("new_attpm_id2_" id).style.display = "none"; The problem was successfully solved.

Please open under ie6: ie6_js_hidden_select_bug.html

Pass:

document.getElementById('J_Test').style.display = 'none';
Yes Hide the select element.

But pass:

document.body.id = 'page';
With css code:

#page select { display: none; }
Under ie6, the select element cannot be hidden.
Tried position, setTimeout, changing zoom to 1.001 and other methods, but all failed.

I think of the notorious bug that select needs to be masked with an iframe under IE6. It is estimated that the root cause is the same as the bug above: under IE6, select is a windowed element, and its performance is essentially the same as that of ordinary HTML elements. difference. As for why? I guess I can only look at Microsoft's source code.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn