document.getElementById(...)'为空或不是对象,出现这个问题要怎么办呢?上传资料到空间浏览器一打开就卡
<scriptlanguage="javascript">functionqiehuan(num){for(varid=0;id<=9;id++){if(id==num)...
<script language="javascript">
function qiehuan(num){
for(var id = 0;id<=9;id++)
{
if(id==num)
{
document.getElementById("qh_con"+id).style.display="block";
document.getElementById("mynav"+id).className="nav_on";
}
else
{
document.getElementById("qh_con"+id).style.display="none";
document.getElementById("mynav"+id).className="";
}
}
}
</script>
<div id=menu_out>
<div id=menu_in>
<div id=menu>
<UL id=nav>
<LI><A class=nav_on id=mynav0 onmouseover=javascript:qiehuan(0) href="/index.asp"><SPAN>网站首页</SPAN></A></LI>
<LI class="menu_line"></LI><li><a href="/intro.asp" onmouseover="javascript:qiehuan(1)" id="mynav1" class="nav_off"><span>学校简介</span></a></li>
<li class="menu_line"></li><li><a href="" onmouseover="javascript:qiehuan(2)" id="mynav2" class="nav_off"><span>课程信息</span></a></li>
<li class="menu_line"></li><li><a href="/NewsClass.asp?BigClass=招生信息" onmouseover="javascript:qiehuan(3)" id="mynav3" class="nav_off"><span>招生信息</span></a></li>
<li class="menu_line"></li>
<li><a href="/kcsz.asp?Title=名师团队" onmouseover="javascript:qiehuan(4)" id="mynav4" class="nav_off"><span>名师团队</span></a></li>
<li class="menu_line"></li>
<li><a href="/NewsClass.asp?BigClass=学生天地" onmouseover="javascript:qiehuan(5)" id="mynav5" class="nav_off"><span>学生天地</span></a></li>
<li class="menu_line"></li><li><a href="/NewsClass.asp?BigClass=家长俱乐部" onmouseover="javascript:qiehuan(6)" id="mynav6" class="nav_off"><span>家长俱乐部</span></a></li>
<li class="menu_line"></li><li><a href="/HrDemand.asp" onmouseover="javascript:qiehuan(7)" id="mynav7" class="nav_off"><span>招聘英才</span></a></li><li class="menu_line"></li>
<LI><A class=nav_off id=mynav8 onmouseover=javascript:qiehuan(8) href="/Join/Join.html"><SPAN>加盟中心</SPAN></A></LI>
<LI class=menu_line></LI>
</UL>
<div id=menu_con><div id=qh_con0 style="DISPLAY: block">
<UL>
</UL></div>
<div id=qh_con1 style="DISPLAY: none">
<UL></UL></div>
<div id=qh_con2 style="DISPLAY: none ; padding-left:65px">
<UL> <LI><a href="/kcsz.asp?Title=国际学前教育"><span>国际学前教育</span></A></LI>
<LI class=menu_line2></LI><LI><A href="/kcsz.asp?Title=潜能开发中心"><SPAN>潜能开发中心</SPAN></A></LI><LI class=menu_line2></LI><LI><A href="/kcsz.asp?Title=辅导中心"><SPAN>辅导中心</SPAN></A></LI></UL></div>
<div id=qh_con3 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con4 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con5 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con6 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con7 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con8 style="DISPLAY: none">
<UL></UL></div>
<div id=qh_con9 style="DISPLAY: none">
<UL></UL></div> </div></div></div></div> 展开
function qiehuan(num){
for(var id = 0;id<=9;id++)
{
if(id==num)
{
document.getElementById("qh_con"+id).style.display="block";
document.getElementById("mynav"+id).className="nav_on";
}
else
{
document.getElementById("qh_con"+id).style.display="none";
document.getElementById("mynav"+id).className="";
}
}
}
</script>
<div id=menu_out>
<div id=menu_in>
<div id=menu>
<UL id=nav>
<LI><A class=nav_on id=mynav0 onmouseover=javascript:qiehuan(0) href="/index.asp"><SPAN>网站首页</SPAN></A></LI>
<LI class="menu_line"></LI><li><a href="/intro.asp" onmouseover="javascript:qiehuan(1)" id="mynav1" class="nav_off"><span>学校简介</span></a></li>
<li class="menu_line"></li><li><a href="" onmouseover="javascript:qiehuan(2)" id="mynav2" class="nav_off"><span>课程信息</span></a></li>
<li class="menu_line"></li><li><a href="/NewsClass.asp?BigClass=招生信息" onmouseover="javascript:qiehuan(3)" id="mynav3" class="nav_off"><span>招生信息</span></a></li>
<li class="menu_line"></li>
<li><a href="/kcsz.asp?Title=名师团队" onmouseover="javascript:qiehuan(4)" id="mynav4" class="nav_off"><span>名师团队</span></a></li>
<li class="menu_line"></li>
<li><a href="/NewsClass.asp?BigClass=学生天地" onmouseover="javascript:qiehuan(5)" id="mynav5" class="nav_off"><span>学生天地</span></a></li>
<li class="menu_line"></li><li><a href="/NewsClass.asp?BigClass=家长俱乐部" onmouseover="javascript:qiehuan(6)" id="mynav6" class="nav_off"><span>家长俱乐部</span></a></li>
<li class="menu_line"></li><li><a href="/HrDemand.asp" onmouseover="javascript:qiehuan(7)" id="mynav7" class="nav_off"><span>招聘英才</span></a></li><li class="menu_line"></li>
<LI><A class=nav_off id=mynav8 onmouseover=javascript:qiehuan(8) href="/Join/Join.html"><SPAN>加盟中心</SPAN></A></LI>
<LI class=menu_line></LI>
</UL>
<div id=menu_con><div id=qh_con0 style="DISPLAY: block">
<UL>
</UL></div>
<div id=qh_con1 style="DISPLAY: none">
<UL></UL></div>
<div id=qh_con2 style="DISPLAY: none ; padding-left:65px">
<UL> <LI><a href="/kcsz.asp?Title=国际学前教育"><span>国际学前教育</span></A></LI>
<LI class=menu_line2></LI><LI><A href="/kcsz.asp?Title=潜能开发中心"><SPAN>潜能开发中心</SPAN></A></LI><LI class=menu_line2></LI><LI><A href="/kcsz.asp?Title=辅导中心"><SPAN>辅导中心</SPAN></A></LI></UL></div>
<div id=qh_con3 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con4 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con5 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con6 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con7 style="DISPLAY: none">
<UL></LI></UL></div>
<div id=qh_con8 style="DISPLAY: none">
<UL></UL></div>
<div id=qh_con9 style="DISPLAY: none">
<UL></UL></div> </div></div></div></div> 展开
2个回答
展开全部
你这里都没有9
怎么循环里是
for(var id = 0;id<=9;id++)
直到9呢
你只要去掉等于
for(var id = 0;id<9;id++)
这样就行了
试试吧
怎么循环里是
for(var id = 0;id<=9;id++)
直到9呢
你只要去掉等于
for(var id = 0;id<9;id++)
这样就行了
试试吧
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询