- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <head>
- <title> New Document </title>
- <script type="text/javascript">
-
- function change()
- {
- var dlNode = event.srcElement;
- var parentNode = dlNode.parentNode;
-
- var otherNode = document.getElementsByTagName("dl");
- for(var i=0;i< otherNode.length;i++)
- {
- if(otherNode[i]== parentNode)
- {
- if(parentNode.className =="open")
- {
- parentNode.className = "close";
- }else
- {
- parentNode.className = "open";
- }
- }else
- otherNode[i].className = "close";
- }
-
- }
-
- </script>
- <style type="text/css">
- dl{
- /*设置手势 */
- cursor:pointer;
- height:80px;
- }
- dt{
- /*每次显示导航条*/
- overflow:hidden;
- height:20px;
- }
- .open{
- /*高度展开*/
- height:80px;
- }
- .close{
- /*恢复就好了*/
- height:20px;
- overflow:hidden;
- }
- </style>
- </head>
- <body>
- <dl>
- <dt onclick ="change()">船舶管理</dt>
- <dd>主演:王额外</dd>
- <dd>主演:江苏大丰</dd>
- <dd>导演:斯蒂芬</dd>
- </dl>
- <dl>
- <dt onclick ="change()">同行要素</dt>
- <dd>主演:王额外</dd>
- <dd>主演:江苏大丰</dd>
- <dd>导演:斯蒂芬</dd>
- </dl>
- <dl>
- <dt onclick ="change()">权限设置</dt>
- <dd>主演:王额外</dd>
- <dd>主演:江苏大丰</dd>
- <dd>导演:斯蒂芬</dd>
- </dl>
- </body>
- </html>
复制代码
有点很抱歉,由于时间关系. 一开始全是展开的我就没有修改了 我得捉紧学习了 你代码修改判断一下就好了 |