如何实现菜单打开是关闭的??点击后打开菜单
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
//Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
{
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[i][theObj];
for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers[i].document);
if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
return foundObj;
}
</script>
<style type="text/css">
<!--
.ab {
background-image: url(4.gif);
background-repeat: no-repeat;
cursor: hand;
}
.ab2 {
background-image: url(02.gif);
background-repeat: no-repeat;
padding-left: 15px;
cursor: hand;
}
.ab1 {
padding-left: 25px;
}
-->
</style>
</head>
<body>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" bgcolor="#0099FF" class="ab" onmouseup="with(findObj('xwgl'))if(style.display=='none') {style.display=''; this.style.backgroundImage='url(3.gif)'}else{style.display='none'; this.style.backgroundImage='url(4.gif)'}">新闻管理</td>
</tr>
<tr id="xwgl">
<td height="25" class="ab1"><table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" class="ab2"><a href="#">新闻修改</a></td>
</tr>
<tr>
<td height="25" class="ab2"><a href="#">新闻审核</a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="25" bgcolor="#0099FF" class="ab" onmouseup="with(findObj('tpgl'))if(style.display=='none') {style.display=''; this.style.backgroundImage='url(3.gif)'}else{style.display='none'; this.style.backgroundImage='url(4.gif)'}">图片管理</td>
</tr>
<tr id="tpgl">
<td height="25" class="ab1"><table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25" class="ab2"><a href="#">图片修改</a></td>
</tr>
<tr>
<td height="25" class="ab2"><a href="#">图片审核</a></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
[此贴子已经被作者于2007-7-2 14:02:57编辑过]