document.getElementById()为空或不是对象
<scripttype="text/javascript">functionShowTabs(ID){for(i=0;i<4;i++){if(i==ID){alert(d...
<script type="text/javascript">
function ShowTabs(ID) {
for (i = 0; i < 4; i++) {
if (i == ID) {
alert(document.getElementById("a" + i));
document.getElementById("a" + i).className = "c2";
//document.getElementById("Tab" + i).style.display = "";
}
else {
alert(document.getElementById("a" + i));
document.getElementById("a" + i).className = "c1";
//document.getElementById("Tab" + i).style.display = "none";
}
}
}
</script>
<div id="a1" class="c2" onmouseover="ShowTabs(0)">哈哈</div>
<div id="a1" class="c1" onmouseover="ShowTabs(1)">哈哈</div>
<div id="a1" class="c1" onmouseover="ShowTabs(2)">哈哈</div> 展开
function ShowTabs(ID) {
for (i = 0; i < 4; i++) {
if (i == ID) {
alert(document.getElementById("a" + i));
document.getElementById("a" + i).className = "c2";
//document.getElementById("Tab" + i).style.display = "";
}
else {
alert(document.getElementById("a" + i));
document.getElementById("a" + i).className = "c1";
//document.getElementById("Tab" + i).style.display = "none";
}
}
}
</script>
<div id="a1" class="c2" onmouseover="ShowTabs(0)">哈哈</div>
<div id="a1" class="c1" onmouseover="ShowTabs(1)">哈哈</div>
<div id="a1" class="c1" onmouseover="ShowTabs(2)">哈哈</div> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询