js實現(xiàn)的折疊導(dǎo)航示例
更新時間:2013年11月29日 17:41:13 作者:
折疊導(dǎo)航的實現(xiàn)方法有很多,在文本為大家介紹下如何使用js實現(xiàn)的折疊導(dǎo)航,感興趣的朋友可以參考下
復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv=content-type content="text/html; charset=utf-8" />
<link href="css/admin.css" type="text/css" rel="stylesheet" />
<script language=javascript>
function expand(el)//傳遞的是id,1,2,3用來區(qū)分所屬的分類
{
childobj = document.getElementById("child" + el);//child1,child2.....
if (childobj.style.display == 'none')//如果此元素師none,就不會被顯示
{
childobj.style.display = 'block';//如果是block。就會顯示為塊級元素
}
else
{
childobj.style.display = 'none';//當(dāng)再次點擊時,那么就會又隱藏起來
}
return;
}
</script>
</head>
<body>
<table height="100%" cellspacing=0 cellpadding=0 width=170
background=./img/menu_bg.jpg border=0>
<tr>
<td valign=top align=middle>
<table cellspacing=0 cellpadding=0 width="100%" border=0>
<tr>
<td height=10></td>
</tr>
</table>
<table cellspacing=0 cellpadding=0 width=150 border=0>
<tr height=22>
<td style="padding-left: 30px" background=./img/menu_bt.jpg>
<a class=menuparent onclick=expand(1) href="javascript:void(0);">人員管理</a></td></tr>
<tr height=4>
<td></td></tr></table>
<table id=child1 style="display: none" cellspacing=0 cellpadding=0
width=150 border=0>
<tr height=20>
<td align=middle width=30><img height=9
src="./img/menu_icon.gif" width=9></td>
<td><a class=menuchild
href="memberadd.jsp"
target=right>人員增加</a></td></tr>
<tr height=20>
<td align=middle width=30><img height=9
src="./img/menu_icon.gif" width=9></td>
<td><a class=menuchild
href="#"
target=right>人員修改</a></td></tr>
<tr height=20>
<td align=middle width=30><img height=9
src="./img/menu_icon.gif" width=9></td>
<td><a class=menuchild
href="#"
target=right>人員刪除</a></td></tr>
<tr height=20>
<td align=middle width=30><img height=9
src="./img/menu_icon.gif" width=9></td>
<td><a class=menuchild
href="#"
target=right>人員查找</a></td></tr>
<tr height=4>
<td colspan=2></td>
</tr>
</table>
</body>
</html>
相關(guān)文章
JS遍歷ul下的li點擊彈出li的索引的實現(xiàn)方法
這篇文章主要介紹了JS遍歷ul下的li點擊彈出li的索引的方法,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-09-09
iframe的onload在Chrome/Opera中執(zhí)行兩次Bug的解決方法
創(chuàng)建iframe對象,添加load事件, 再將iframe添加到body中。Chrome/Opera中會造成load事件的handler執(zhí)行兩次。2011-03-03
JavaScript報錯:Uncaught TypeError: Cannot set&n
在 JavaScript 編程中,“Uncaught TypeError: Cannot set property ‘X’ of undefined” 是一種常見的錯誤,這種錯誤通常發(fā)生在試圖給一個未定義的對象的屬性賦值時,本文介紹了JavaScript報錯的解決方案,需要的朋友可以參考下2024-07-07

