js选项卡的问题 解决一个页面不能用两个选项卡
//JS代码:
function tabOn(tabid,a) {
for (i=1;i<=10;i++) {
if(i<10){inn="0"+i;} else {inn=""+i;}
tabMenu = document.getElementById("tab"+tabid+"m"+i);
tabContent = document.getElementById("tab"+tabid+"c"+i);
tabMore = document.getElementById("tab"+tabid+"more"+i);
if (tabMenu) {
if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace("on.gif", ".gif"); }
if (tabMenu.tagName=="A") { tabMenu.className=""; }
}
if (tabContent) { tabContent.style.display="none"; }
if (tabMore) { tabMore.style.display="none"; }
}
if(a<10){ann="0"+a;} else {ann=""+a;}
tabMenu = document.getElementById("tab"+tabid+"m"+a);
tabContent = document.getElementById("tab"+tabid+"c"+a);
tabMore = document.getElementById("tab"+tabid+"more"+a);
// alert(tabMenu.tagName);
if (tabMenu) {
if (tabMenu.tagName=="IMG") { tabMenu.src = tabMenu.src.replace(".gif", "on.gif"); }
if (tabMenu.tagName=="A") { tabMenu.className="on"; }
}
if (tabContent) { tabContent.style.display="block"; }
if (tabMore) { tabMore.style.display="block"; }
}
function imgMenuOver(containderID) {
var objwrap = document.getElementById(containderID);
var imgMenu = objwrap.getElementsByTagName("a");
for (i=0; i<imgMenu.length; i++) {
if(imgMenu[i].getElementsByTagName("img").length == 0) continue;
if (imgMenu[i].getElementsByTagName("img")[0].src.indexOf("_on.gif") != -1 ) {
continue;
}
imgMenu[i].onmouseover = function() {
subImage = this.getElementsByTagName("img")[0];
if (subImage.src.indexOf("_on.gif") != -1) return false;
subImage.src = subImage.src.replace("_off.gif","_on.gif");
}
imgMenu[i].onfocus = function() {
subImage = this.getElementsByTagName("img")[0];
if (subImage.src.indexOf("_on.gif") != -1) return false;
subImage.src = subImage.src.replace("_off.gif","_on.gif");
}
imgMenu[i].onmouseout = function() {
subImage = this.getElementsByTagName("img")[0];
subImage.src = subImage.src.replace("_on.gif", "_off.gif");
}
imgMenu[i].onblur = function() {
subImage = this.getElementsByTagName("img")[0];
subImage.src = subImage.src.replace("_on.gif", "_off.gif");
}
}
}
HTML代码:
<div id="board" class="clearfix">
<h2><img src="images/notice_title.gif" width="48" height="13" alt="????" /></h2>
<ul class="clearfix">
<li class="first">
<a href="#tab1c1" onclick="tabOn(1,1); return false;" onmouseover="tabOn(1,1); return false;">
<img src="images/tab1m01on.gif" height="23" alt="??" id="tab1m1" />
</a>
<div id="tab1c1" class="tabcontent">
<ul>
<li>
<a href="#">
[??]
MOS Master 1,2 ???..
</a>
<span>2012-04-11</s