js提示缺少对象,代码贴出来了,求解

<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 class="menu">
<ul>
<li class="first"><a href="#" onmouseover="javascript:qiehuan(0)" id="mynav0" class="nav_on">首 页</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(1)" id="mynav1" class="nav_off">酷站代码</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(2)" id="mynav2" class="nav_off">网页特效</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(3)" id="mynav3" class="nav_off">网页教程</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(4)" id="mynav4" class="nav_off">建站教程</a></li>
<li class="last"><a href="#" onmouseover="javascript:qiehuan(5)" id="mynav5" class="nav_off">建站教程</a></li>
</ul>
</div>
<div class="ft">
<div id="qh_con0" style="display:block">
<a href="#">栏目名称1</a>
<a href="#">栏目名称2</a>
<a href="#">栏目名称3</a>
</div>
<div id="qh_con1" style="display:none">
<a href="#">栏目名称4</a>
<a href="#">栏目名称5</a>
<a href="#">栏目名称6</a>
</div>
<div id="qh_con2" style="display:none">
<a href="#">栏目名称7</span></a>
<a href="#">栏目名称8</span></a>
<a href="#">栏目名称9</span></a>
</div>
<div id="qh_con3" style="display:none">
<a href="#">栏目名称10</a>
<a href="#">栏目名称11</a>
<a href="#">栏目名称12</a>
</div>
<div id="qh_con4" style="display:none">
<a href="#">栏目名称13</a>
<a href="#">栏目名称14</a>
<a href="#">栏目名称15</a>
</div>
<div id="qh_con5" style="display:none">
<a href="#">栏目名称16</a>
<a href="#">栏目名称17</a>
<a href="#">栏目名称18</a>
</div>
</div>
IE提示12行字符17缺少对象求解,不知道哪里有错误啊
展开
 我来答
wangnasa
推荐于2016-09-05 · TA获得超过776个赞
知道小有建树答主
回答量:732
采纳率:100%
帮助的人:642万
展开全部
这段代码 我在IE9 firefox14 chrome 下都测了 没问题 是不是 你的其他代码有问题

<html>
<head>
</head>
<body>
<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 class="menu">
<ul>
<li class="first"><a href="#" onmouseover="javascript:qiehuan(0)" id="mynav0" class="nav_on">首 页</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(1)" id="mynav1" class="nav_off">酷站代码</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(2)" id="mynav2" class="nav_off">网页特效</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(3)" id="mynav3" class="nav_off">网页教程</a></li>
<li><a href="#" onmouseover="javascript:qiehuan(4)" id="mynav4" class="nav_off">建站教程</a></li>
<li class="last"><a href="#" onmouseover="javascript:qiehuan(5)" id="mynav5" class="nav_off">建站教程</a></li>
</ul>
</div>
<div class="ft">
<div id="qh_con0" style="display:block">
<a href="#">栏目名称1</a>
<a href="#">栏目名称2</a>
<a href="#">栏目名称3</a>
</div>
<div id="qh_con1" style="display:none">
<a href="#">栏目名称4</a>
<a href="#">栏目名称5</a>
<a href="#">栏目名称6</a>
</div>
<div id="qh_con2" style="display:none">
<a href="#">栏目名称7</span></a>
<a href="#">栏目名称8</span></a>
<a href="#">栏目名称9</span></a>
</div>
<div id="qh_con3" style="display:none">
<a href="#">栏目名称10</a>
<a href="#">栏目名称11</a>
<a href="#">栏目名称12</a>
</div>
<div id="qh_con4" style="display:none">
<a href="#">栏目名称13</a>
<a href="#">栏目名称14</a>
<a href="#">栏目名称15</a>
</div>
<div id="qh_con5" style="display:none">
<a href="#">栏目名称16</a>
<a href="#">栏目名称17</a>
<a href="#">栏目名称18</a>
</div>
</div>
</body>
</html>
更多追问追答
追问
你好 IE6提示缺少对象,目前使用IE6的人还是很多,所以怕以后出什么问题
追答
IE6是垃圾 对DIV的兼容性非常差  
else
{
document.getElementById("qh_con"+id).style.display="none";
document.getElementById("mynav"+id).className="nav_off";
}
这个classname为空改成nav_off试一下
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式