A bug that Firefox handles to ChildNodes
Childnodesfirefox No filter wrapping and spaces in the processing childnodes. So in the initial use, the results are not expected effect.
Html
Copy Code code as follows:
<ul class= "tbtn" id= "Menulist" >
<li class= "Curr" id= "Tabap3_btn_0" onclick= "Tabit" (This) "> Finance University b</li>
<li id= "tabap3_btn_1" onclick= "Tabit (This)" > Famous Doctors ' Forum </li>
<li id= "tabap3_btn_2" onclick= "Tabit (This)" > Famous Doctors ' Forum </li>
<li id= "Tabap3_btn_3" onclick= "Tabit (This)" > Famous Doctors ' Forum </li>
<li class= "LST" id= "Tabap3_btn_4" onclick= "Tabit" (This) "> Movie hotspot </li>
</ul>
Js
Copy Code code as follows:
function Tabit (BTN)
{
var idname = new String (btn.id);
var s = Idname.indexof ("_");
var e = Idname.lastindexof ("_") +1;
var tabname = idname.substr (0, s);
var id = parseint (idname.substr (E, 1));
var tabnumber = btn.parentNode.childNodes.length; Different values for IE and FF
for (i=0;i<tabnumber;i++)
{
if (document.getElementById (tabname+ "_div_" +i)!=null)//here needs to be judged
{
document.getElementById (tabname+ "_div_" +i). Style.display = "None";
document.getElementById (tabname+ "_btn_" +i). Style.backgroundimage = "url (pic/t-1-2.gif)";
document.getElementById (tabname+ "_btn_" +i). Style.borderbottomcolor = "#D7F2DA";
document.getElementById (tabname+ "_btn_" +i). Style.cursor = "pointer";
}
}
document.getElementById (tabname+ "_div_" +id). Style.display = "block";
Btn.style.backgroundColor = "#fff";
Btn.style.borderBottomColor = "#fff";
Btn.style.cursor = "Default";
}
On IE, the value of the Menulist Childnodes.length is 5, while the Firefox value is 11. So we need to judge or remove the space when we use the ChildNodes object.