htm页面:
<script src="js/admin_js.js" langage="javascript"></script>
<langage de script=JavaScript>
document.onclick = clickList ;
</script>
<table width="216" border="0" cellpadding="0" cellpacing="0">
<tr>
<td height="533" background="images/left.jpg" align="center" valign="top">
<div id=div0 style="largeur:216; position:relative">
<label id=div0 style="cursor: hand; background:url(images/left_main.jpg); width:216; height:31; text-align:center; color:#f0f0f0; padding-top:12px">部门管理</span></label>
</div>
<div id=div0other style="display:None; width:216">
<label style="background:url(images/left_part.jpg); width:216; height:24; padding-top:8px"><a href="bmgl/show_depart.php" target="mainFrame">
查看部门</a></label>
<label style="background:url(images/left_part.jpg); width:216; height:24; padding-top:8px"><a href="bmgl/add_depart.php" target="mainFrame">添加部门</a></label>
</div>
javascript:admin_js.js
fonction clickList() {
var targetId, srcElement, targetElement ;
/*event. srcElement : (指向触发事件的元素)。 document.onclick = clickList;么地方,做相应处理。*/
srcElement = window.event.srcElement ;
/*srcElement.className :
if (srcElement.className == "active") {
/*在目标ID后加上"other"字符串,此例即为:div0other,代表子菜单*/
targetId = srcElement.id + "autre" ;
targetElement = document.all(targetId); //式
为不可见*/
if (targetElement.style.display == "aucun") {
targetElement.style.display = "";
} autre {
targetElement.style.display = "aucun" ;
}
}
}