这段代码在ie下显示正常,可以在firefox好像没什么作用,请高手赐教,谢谢! var debug = false ;
function switchTab (tab)
{ event.returnValue = false ;
var tabName = getTabGroupName (tab.id) ;
if (tabName == '')
{ alert ("No tabName for tab [" + tab.id + "]") ;
return ;
}
var index = 1 ;
while (true)
{ var tabTitle = eval ("document.all ('" + tabName + '_' + index + "')") ;
if (tabTitle == undefined)
break ;
deactiveTabTitle (tabTitle , tabName) ;
var tabContent = eval ("document.all ('" + tabName + '_' + index + '_content' + "')") ;
if (tabContent != undefined)
tabContent.style.display = "NONE" ;
index ++ ;
}
if (debug)
alert ("Find " + (index - 1) + " tab title(s) for TabName [" + tabName + "]") ;
activeTabTitle (tab , tabName) ;
var tabContent = eval ("document.all ('" + tab.id + '_content' + "')") ;
if (tabContent != undefined)
tabContent.style.display = "BLOCK" ;
} function cancelTab ()
{
}
function getTabGroupName (tabId)
{
if (tabId == '' ¦ ¦ tabId == undefined)
{
alert ("tabId is NULL! [" + tabId + "]") ;
return ;
}
var i = tabId.lastIndexOf ('_') ;
if (i <= 1)
return '' ;
return tabId.substr (0 , i) ;
}
function deactiveTabTitle (tab , tabName)
{
tab.className = tabName + "_off" ;
} function activeTabTitle (tab , tabName)
{
tab.className = tabName + "_on" ;
}
function switchTab (tab)
{ event.returnValue = false ;
var tabName = getTabGroupName (tab.id) ;
if (tabName == '')
{ alert ("No tabName for tab [" + tab.id + "]") ;
return ;
}
var index = 1 ;
while (true)
{ var tabTitle = eval ("document.all ('" + tabName + '_' + index + "')") ;
if (tabTitle == undefined)
break ;
deactiveTabTitle (tabTitle , tabName) ;
var tabContent = eval ("document.all ('" + tabName + '_' + index + '_content' + "')") ;
if (tabContent != undefined)
tabContent.style.display = "NONE" ;
index ++ ;
}
if (debug)
alert ("Find " + (index - 1) + " tab title(s) for TabName [" + tabName + "]") ;
activeTabTitle (tab , tabName) ;
var tabContent = eval ("document.all ('" + tab.id + '_content' + "')") ;
if (tabContent != undefined)
tabContent.style.display = "BLOCK" ;
} function cancelTab ()
{
}
function getTabGroupName (tabId)
{
if (tabId == '' ¦ ¦ tabId == undefined)
{
alert ("tabId is NULL! [" + tabId + "]") ;
return ;
}
var i = tabId.lastIndexOf ('_') ;
if (i <= 1)
return '' ;
return tabId.substr (0 , i) ;
}
function deactiveTabTitle (tab , tabName)
{
tab.className = tabName + "_off" ;
} function activeTabTitle (tab , tabName)
{
tab.className = tabName + "_on" ;
}
function switchTab (tab)
{ event.returnValue = false ;
var tabName = getTabGroupName (tab.id) ;
if (tabName == '')
{ alert ("No tabName for tab [" + tab.id + "]") ;
return ;
}
var index = 1 ;
while (true)
{ var tabTitle = eval ("document.getElementById ('" + tabName + '_' + index + "')") ;
if (tabTitle == undefined)
break ;
deactiveTabTitle (tabTitle , tabName) ;
var tabContent = eval ("document.getElementById ('" + tabName + '_' + index + '_content' + "')") ;
if (tabContent != undefined)
tabContent.style.display = "NONE" ;
index ++ ;
}
if (debug)
alert ("Find " + (index - 1) + " tab title(s) for TabName [" + tabName + "]") ;
activeTabTitle (tab , tabName) ;
var tabContent = eval ("document.getElementById ('" + tab.id + '_content' + "')") ;
if (tabContent != undefined)
tabContent.style.display = "BLOCK" ;
} function cancelTab ()
{
}
function getTabGroupName (tabId)
{
if (tabId == '' || tabId == undefined)
{
alert ("tabId is NULL! [" + tabId + "]") ;
return ;
}
var i = tabId.lastIndexOf ('_') ;
if (i <= 1)
return '' ;
return tabId.substr (0 , i) ;
}
function deactiveTabTitle (tab , tabName)
{
tab.className = tabName + "_off" ;
}
function activeTabTitle (tab , tabName)
{
tab.className = tabName + "_on" ;
}
http://blog.csdn.net/herowach/archive/2007/09/13/1783687.aspx
在FF下调式可以用Firebug