htm页面:
<script src="js/admin_js.js" Language="javascript"></script>
<bahasa skrip=JavaScript>
document.onclick = klikDaftar;
</skrip>
<tabel lebar = "216" perbatasan = "0" cellpadding = "0" sel spasi = "0">
<tr>
<td height="533" background="images/left.jpg" align="center" valign="top">
<div id=div0 style="lebar:216; posisi:relatif">
<label id=div0 style="cursor: hand; background:url(images/left_main.jpg); lebar:216; tinggi:31; perataan teks:tengah; warna:#f0f0f0; padding-top:12px">部门管理</span></label>
</div>
<div id=div0other style="display:Tidak Ada; lebar:216">
<label style="background:url(images/left_part.jpg); lebar:216; tinggi:24; padding-top:8px"><a href="bmgl/show_depart.php" target="mainFrame">
查看部门</a></label>
<label style="background:url(images/left_part.jpg); lebar:216; tinggi:24; padding-top:8px"><a href="bmgl/add_depart.php" target="mainFrame">添加部门</a></label>
</div>
javascript:admin_js.js
fungsi clickList() {
var targetId, srcElement, targetElement;
/*event对象指当前触发的事件对象, window.event.srcElement是指触发事件的对象(event:得到或设置触发事件的对象,event. srcElement:指向触发事件的元素)。比如上面htm页面设定document.onclick = clickList;方,做相应处理。*/
srcElement = jendela.event.srcElement;
/*srcElement.className:得到触发事件对象的样式名称,对应上面htm页面class=active */
if (srcElement.className == "aktif") {
/*在目标ID后加上"other"字符串,此例即为:div0other,代表子菜单*/
targetId = srcElement.id + "lainnya";
targetElement = document.all(targetId);//当点击母菜单"部门管理后",显示子菜单"查看部门"、"添加部门"
/*下面,默认子菜单样式为不可见*/
if (targetElement.style.display == "tidak ada") {
targetElement.style.display = "";
} kalau tidak {
targetElement.style.display = "tidak ada";
}
}
}