javascript树形菜单问题!
<styletype="text/css">body{font-size:12px;}ul{list-style:none;}a{font-size:12px;color...
<style type="text/css">
body
{
font-size:12px;
}
ul
{
list-style:none;
}
a
{
font-size:12px;
color:#000;
text-decoration:none;
}
a:hover
{
color:#F00;
}
</style>
<script type="text/javascript">
function show(id)
{
if(document.getElementById(id).style.display=="block")
{
document.getElementById(id).style.display="none";
}
else
{
document.getElementById(id).style.display="bolck";
}
}
</script>
</head>
<body>
<b><img src="images/fold.gif" />树形菜单</b>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d1')">文学艺术</a></ul>
<ul id="d1">
<li><img src="images/doc.gif" />写作先锋</li>
<li><img src="images/doc.gif" />小说散文</li>
<li><img src="images/doc.gif" />诗风词韵</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d2')">贴图专区</a></ul>
<ul id="d2">
<li><img src="images/doc.gif" />真我风采</li>
<li><img src="images/doc.gif" />视频贴图</li>
<li><img src="images/doc.gif" />行行摄摄</li>
<li><img src="images/doc.gif" />Flash贴图</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d3')">房产八卦</a></ul>
<ul id="d3">
<li><img src="images/doc.gif" />我要买房</li>
<li><img src="images/doc.gif" />楼市话题</li>
<li><img src="images/doc.gif" />我要卖房</li>
<li><img src="images/doc.gif" />租房心语</li>
<li><img src="images/doc.gif" />二手市场</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d4')">娱乐八卦</a></ul>
<ul id="d4">
<li><img src="images/doc.gif" />红楼一梦</li>
<li><img src="images/doc.gif" />笑话论坛</li>
<li><img src="images/doc.gif" />休闲生活</li>
<li><img src="images/doc.gif" />大话春秋</li>
</ul>
</body>
点击4个菜单没反应!不知道哪里有写错! 展开
body
{
font-size:12px;
}
ul
{
list-style:none;
}
a
{
font-size:12px;
color:#000;
text-decoration:none;
}
a:hover
{
color:#F00;
}
</style>
<script type="text/javascript">
function show(id)
{
if(document.getElementById(id).style.display=="block")
{
document.getElementById(id).style.display="none";
}
else
{
document.getElementById(id).style.display="bolck";
}
}
</script>
</head>
<body>
<b><img src="images/fold.gif" />树形菜单</b>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d1')">文学艺术</a></ul>
<ul id="d1">
<li><img src="images/doc.gif" />写作先锋</li>
<li><img src="images/doc.gif" />小说散文</li>
<li><img src="images/doc.gif" />诗风词韵</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d2')">贴图专区</a></ul>
<ul id="d2">
<li><img src="images/doc.gif" />真我风采</li>
<li><img src="images/doc.gif" />视频贴图</li>
<li><img src="images/doc.gif" />行行摄摄</li>
<li><img src="images/doc.gif" />Flash贴图</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d3')">房产八卦</a></ul>
<ul id="d3">
<li><img src="images/doc.gif" />我要买房</li>
<li><img src="images/doc.gif" />楼市话题</li>
<li><img src="images/doc.gif" />我要卖房</li>
<li><img src="images/doc.gif" />租房心语</li>
<li><img src="images/doc.gif" />二手市场</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:onclick=show('d4')">娱乐八卦</a></ul>
<ul id="d4">
<li><img src="images/doc.gif" />红楼一梦</li>
<li><img src="images/doc.gif" />笑话论坛</li>
<li><img src="images/doc.gif" />休闲生活</li>
<li><img src="images/doc.gif" />大话春秋</li>
</ul>
</body>
点击4个菜单没反应!不知道哪里有写错! 展开
展开全部
<a href="javascript:onclick=show('d4')">娱乐八卦</a>
把onclick= 去掉
<a href="javascript:show('d4')">娱乐八卦</a>
把onclick= 去掉
<a href="javascript:show('d4')">娱乐八卦</a>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
帮你改好啦·····
<html>
<head>
<style type="text/css">
body
{
font-size:12px;
}
ul
{
list-style:none;
}
a
{
font-size:12px;
color:#000;
text-decoration:none;
}
a:hover
{
color:#F00;
}
</style>
<script type="text/javascript">
function show(id)
{
if(document.getElementById(id).style.display=="")
{
document.getElementById(id).style.display="none";
}
else
{
document.getElementById(id).style.display="";
}
}
</script>
</head>
<body>
<b><img src="images/fold.gif" />树形菜单</b>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d1')">文学艺术</a></ul>
<ul id="d1" style="display:none">
<li><img src="images/doc.gif" />写作先锋</li>
<li><img src="images/doc.gif" />小说散文</li>
<li><img src="images/doc.gif" />诗风词韵</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d2')">贴图专区</a></ul>
<ul id="d2" style="display:none">
<li><img src="images/doc.gif" />真我风采</li>
<li><img src="images/doc.gif" />视频贴图</li>
<li><img src="images/doc.gif" />行行摄摄</li>
<li><img src="images/doc.gif" />Flash贴图</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d3')">房产八卦</a></ul>
<ul id="d3" style="display:none">
<li><img src="images/doc.gif" />我要买房</li>
<li><img src="images/doc.gif" />楼市话题</li>
<li><img src="images/doc.gif" />我要卖房</li>
<li><img src="images/doc.gif" />租房心语</li>
<li><img src="images/doc.gif" />二手市场</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d4')">娱乐八卦</a></ul>
<ul id="d4" style="display:none">
<li><img src="images/doc.gif" />红楼一梦</li>
<li><img src="images/doc.gif" />笑话论坛</li>
<li><img src="images/doc.gif" />休闲生活</li>
<li><img src="images/doc.gif" />大话春秋</li>
</ul>
</body>
<html>
<head>
<style type="text/css">
body
{
font-size:12px;
}
ul
{
list-style:none;
}
a
{
font-size:12px;
color:#000;
text-decoration:none;
}
a:hover
{
color:#F00;
}
</style>
<script type="text/javascript">
function show(id)
{
if(document.getElementById(id).style.display=="")
{
document.getElementById(id).style.display="none";
}
else
{
document.getElementById(id).style.display="";
}
}
</script>
</head>
<body>
<b><img src="images/fold.gif" />树形菜单</b>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d1')">文学艺术</a></ul>
<ul id="d1" style="display:none">
<li><img src="images/doc.gif" />写作先锋</li>
<li><img src="images/doc.gif" />小说散文</li>
<li><img src="images/doc.gif" />诗风词韵</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d2')">贴图专区</a></ul>
<ul id="d2" style="display:none">
<li><img src="images/doc.gif" />真我风采</li>
<li><img src="images/doc.gif" />视频贴图</li>
<li><img src="images/doc.gif" />行行摄摄</li>
<li><img src="images/doc.gif" />Flash贴图</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d3')">房产八卦</a></ul>
<ul id="d3" style="display:none">
<li><img src="images/doc.gif" />我要买房</li>
<li><img src="images/doc.gif" />楼市话题</li>
<li><img src="images/doc.gif" />我要卖房</li>
<li><img src="images/doc.gif" />租房心语</li>
<li><img src="images/doc.gif" />二手市场</li>
</ul>
<ul><img src="images/fclose.gif" /><a href="javascript:show('d4')">娱乐八卦</a></ul>
<ul id="d4" style="display:none">
<li><img src="images/doc.gif" />红楼一梦</li>
<li><img src="images/doc.gif" />笑话论坛</li>
<li><img src="images/doc.gif" />休闲生活</li>
<li><img src="images/doc.gif" />大话春秋</li>
</ul>
</body>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
帮你改好啦·····
<html>
<head>
<script>
function show(id){
if (id.childNodes[1].style.visibility=="hidden")
{ id.childNodes[1].style.visibility="visible";
id.childNodes[2].style.visibility="visible";
}
else
{id.childNodes[1].style.visibility="hidden";
id.childNodes[2].style.visibility="hidden";
}
}
</script>
</head>
<body><b>
<img src="images/fold.gif" />树形菜单</b>
<ul>
<img src="images/fclose.gif" /></ul>
<a onclick="show(this)">文学艺术
<ul>
<li><img src="images/doc.gif" />写作先锋</li>
<li><img src="images/doc.gif" />小说散文</li>
<li><img src="images/doc.gif" />诗风词韵</li></ul><ul><img src="images/fclose.gif" />
</ul>
</a>
<a onclick="show(this)">贴图专区
<ul>
<li><img src="images/doc.gif" />真我风采</li>
<li><img src="images/doc.gif" />视频贴图</li>
<li><img src="images/doc.gif" />行行摄摄</li>
<li><img src="images/doc.gif" />Flash贴图</li>
</ul>
<ul>
<img src="images/fclose.gif" />
</ul>
</a>
<a onclick="show(this)">房产八卦
<ul >
<li><img src="images/doc.gif" />我要买房</li>
<li><img src="images/doc.gif" />楼市话题</li>
<li><img src="images/doc.gif" />我要卖房</li>
<li><img src="images/doc.gif" />租房心语</li>
<li><img src="images/doc.gif" />二手市场</li></ul>
<ul><img src="images/fclose.gif" />
</ul>
</a>
<a onclick="show(this)">娱乐八卦
<ul >
<li><img src="images/doc.gif" />红楼一梦</li>
<li><img src="images/doc.gif" />笑话论坛</li>
<li><img src="images/doc.gif" />休闲生活</li>
<li><img src="images/doc.gif" />大话春秋</li>
</ul>
</a>
</body>
</html>
<html>
<head>
<script>
function show(id){
if (id.childNodes[1].style.visibility=="hidden")
{ id.childNodes[1].style.visibility="visible";
id.childNodes[2].style.visibility="visible";
}
else
{id.childNodes[1].style.visibility="hidden";
id.childNodes[2].style.visibility="hidden";
}
}
</script>
</head>
<body><b>
<img src="images/fold.gif" />树形菜单</b>
<ul>
<img src="images/fclose.gif" /></ul>
<a onclick="show(this)">文学艺术
<ul>
<li><img src="images/doc.gif" />写作先锋</li>
<li><img src="images/doc.gif" />小说散文</li>
<li><img src="images/doc.gif" />诗风词韵</li></ul><ul><img src="images/fclose.gif" />
</ul>
</a>
<a onclick="show(this)">贴图专区
<ul>
<li><img src="images/doc.gif" />真我风采</li>
<li><img src="images/doc.gif" />视频贴图</li>
<li><img src="images/doc.gif" />行行摄摄</li>
<li><img src="images/doc.gif" />Flash贴图</li>
</ul>
<ul>
<img src="images/fclose.gif" />
</ul>
</a>
<a onclick="show(this)">房产八卦
<ul >
<li><img src="images/doc.gif" />我要买房</li>
<li><img src="images/doc.gif" />楼市话题</li>
<li><img src="images/doc.gif" />我要卖房</li>
<li><img src="images/doc.gif" />租房心语</li>
<li><img src="images/doc.gif" />二手市场</li></ul>
<ul><img src="images/fclose.gif" />
</ul>
</a>
<a onclick="show(this)">娱乐八卦
<ul >
<li><img src="images/doc.gif" />红楼一梦</li>
<li><img src="images/doc.gif" />笑话论坛</li>
<li><img src="images/doc.gif" />休闲生活</li>
<li><img src="images/doc.gif" />大话春秋</li>
</ul>
</a>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询