标题:树形导航问题
取消只看楼主
ztslove
Rank: 1
来 自:北京
等 级:新手上路
帖 子:19
专家分:7
注 册:2010-5-27
结帖率:83.33%
已结贴  问题点数:10 回复次数:1 
树形导航问题
调试了好几次   就是不行   大家    看下 那里出错了   困了 实在是看不出来了  谢谢···
程序代码:
<style type="text/css">
<!--
    a{text-decoration:none}
    #productsmenu , #supportmenu, #contactmenu{
      display:none;
  }
-->
</style> <ul>

 <li><a id="products" href="#">[+] Products</a>
   <ul ID="productsmenu">
      <li><a href="prodlist.html">Product List</a></li>
      <li><a href="order.html">Order Form</a></li>
      <li><a href="pricelist.html">Price List</a></li>
   </ul>

 </li>

 <li><a id="support" href="#">[+] Support</a>
   <ul id="supportmenu">
      <li><a href="sforum.html">Support Forum</a></li>
      <li><a href="scontact.html">Contact Support</a></li>
   </ul>

 </li>

 <li><a ID="contact" href="#">[+] Contact Us</a>
   <ul id="contactmenu">
      <li><a href="contact1.html">Service Department</a></li>
      <li><a href="contact2.html">Sales Department</a></li>
   </ul>

 </li>
</ul>

<script language="javascript">

function Toggle(e) {

if(!document.getElementById) return;
if(!e) var e = window.event;
whichlink = (e.target) ? e.target.id : e.srcElement.id;
obj=document.getElmentById(whichlink + "menu");
visible=(obj.style.display=="block")
key=document.getElementById(whichlink);
keyname=key.firstChild.nodeValue.substring(3);
if (visible){
    obj.style.display="none";
    key.firstChild.nodeValue = "[+]" + keyname;
}else{
    obj.style.display="block";
    key.firstChild.nodeValue = "[-]" + keyname;

    }
}

    document.getElementById("products").onclick=Toggle;
document.getElementById("support").onclick=Toggle;
document.getElementById("contact").onclick=Toggle;


</script>

搜索更多相关主题的帖子: 树形 导航 
2010-06-22 00:12
ztslove
Rank: 1
来 自:北京
等 级:新手上路
帖 子:19
专家分:7
注 册:2010-5-27
得分:0 
呵呵  谢谢啊  可以了  昨晚  太晚了 有点困   没看清 ···  不过我好有哦一个小问题  就是  我把 JavaScript 代码  放到  有序列表的 上面  就不行  这是为什么啊 像下面这样:
程序代码:
<style type="text/css">
<!--
    a{text-decoration:none}
    #productsmenu , #supportmenu, #contactmenu{
      display:none;
  }
-->
</style>

<script language="javascript">

function Toggle(e) {

if(!document.getElementById) return;
if(!e) var e = window.event;
whichlink = (e.target) ? e.target.id : e.srcElement.id;
obj=document.getElementById(whichlink + "menu");
visible=(obj.style.display=="block")
key=document.getElementById(whichlink);
keyname=key.firstChild.nodeValue.substring(3);
if (visible){
    obj.style.display="none";
    key.firstChild.nodeValue = "[+]" + keyname;
}else{
    obj.style.display="block";
    key.firstChild.nodeValue = "[-]" + keyname;

    }
}

    document.getElementById("products").onclick=Toggle;
document.getElementById("support").onclick=Toggle;
document.getElementById("contact").onclick=Toggle;


</script>

 <ul>
<li><a id="products" href="#">[+] Products</a>
   <ul ID="productsmenu">
      <li><a href="prodlist.html">Product List</a></li>
      <li><a href="order.html">Order Form</a></li>
      <li><a href="pricelist.html">Price List</a></li>
   </ul>
</li>
<li><a id="support" href="#">[+] Support</a>
   <ul id="supportmenu">
      <li><a href="sforum.html">Support Forum</a></li>
      <li><a href="scontact.html">Contact Support</a></li>
   </ul>
</li>
<li><a ID="contact" href="#">[+] Contact Us</a>
   <ul id="contactmenu">
      <li><a href="contact1.html">Service Department</a></li>
      <li><a href="contact2.html">Sales Department</a></li>
   </ul>
</li>
</ul>

2010-06-22 23:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-310881-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.364520 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved