A BUG in Firefox's handling of childNodes
childNodesFirefox does not filter line breaks and spaces when processing childNodes. Therefore, when using it for the first time, the effect obtained is not the expected effect.
HTML
JS
function tab(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; //The values of IE and FF are different (tabName "_div_" i)!=null) //You need to make a judgment here
{
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";
. ;
btn.style.backgroundColor = "#fff";
btn.style.borderBottomColor = "#fff";
btn.style.cursor = "default";
}
The value of childNodes.length of menuList on IE is 5, while the value on Firefox is 11. Therefore, when using the childNodes object, we need to judge it or remove spaces first.
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