帮忙看看这个JS菜单
默认状态下全部子菜单都是打开的,我希望我一进入页面时,所有的子菜单都是关闭的,请大侠帮忙改一下,我对js不是太熟悉,谢谢!
<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>
<table>
<tr>
<td class="menu" onMouseUp="with(findObj('ph'))if(style.display=='none'){style.display='';this.style.backgroundImage='url(images/control/o.gif)'}else{style.display='none';this.style.backgroundImage='url(images/control/c.gif)'}"><strong>资料管理</strong></td>
</tr>
<tr id="ph">
<td class="submenu"><table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td class="file"><a href="company.asp" class="menutop" target="mainFrame">基本数据</a></td>
</tr>
<tr>
<td class="file"><a href="change_pwd.asp" class="menutop" target="mainFrame">修改密码</a></td>
</tr>
</table>