You cannot use block to hide table rows in Firefox.
The following code can be executed normally in IE, but it is a bit abnormal in Firefox:
<Script language = "JavaScript">
Function testblack (tagname ){
VaR OBJ = Document. getelementbyid (tagname );
If (obj. style. Display = "Block "){
OBJ. style. Display = "NONE ";
} Else {
OBJ. style. Display = "Block ";
}
}
</SCRIPT>
<Table width = "760" border = "0" cellspacing = "0" cellpadding = "0">
<Tr onclick = "testblack ('divb ');">
<TD width = "760" Height = "20" bgcolor = "#00 CCFF"> click me! </TD>
</Tr>
<Tr id = "divb" style = "display: block;">
<TD width = "760" Height = "60" bgcolor = "# 9966ff"> </TD>
</Tr>
</Table>
Some netizens said that CSS may be unable to process tables. I personally think it is not because the above Code can be executed normally on IE; some netizens also said that the execution of "display: none;" was not recycled after "display: block;" opened page space was executed in Firefox, and "display: block;" was executed next time; "The display space will be re-created on the page, which is also untenable. The following code is normal for Firefox execution when used on Div:
<Script language = "JavaScript">
Function testblack (tagname ){
VaR OBJ = Document. getelementbyid (tagname );
If (obj. style. Display = "Block "){
OBJ. style. Display = "NONE ";
} Else {
OBJ. style. Display = "Block ";
}
}
</SCRIPT>
<Div style = "width: 760px; Height: 20px;" onclick = "testblack ('diva ');"> click me! </Div>
<Div id = "Diva" style = "width: 760px; Height: 60px; display: block;"> </div>
So far, we have not found a credible reason, but it does not mean that the table rows cannot be dynamically displayed/hidden in Firefox. display = ""; 'replaces 'style. display = "Block:
<Script language = "JavaScript">
Function testblack (tagname ){
VaR OBJ = Document. getelementbyid (tagname );
If (obj. style. Display = ""){
OBJ. style. Display = "NONE ";
} Else {
OBJ. style. Display = "";
}
}
</SCRIPT>
<Table width = "760" border = "0" cellspacing = "0" cellpadding = "0">
<Tr onclick = "testblack ('divc ');">
<TD width = "760" Height = "20" bgcolor = "#00 CCFF"> click me! </TD>
</Tr>
<Tr id = "divc">
<TD width = "760" Height = "60" bgcolor = "# 9966ff"> </TD>
</Tr>
</Table>