初始化的时候树形菜单是展开的,可否初始化的时候二级子菜单是隐藏起来的,点击之后才展开。请高手赐教,不甚感激,谢谢!(代码如下)<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<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>
<title>无标题文档</title>
<style type="text/css">
<!--
.emenu {
background-image: url(e.gif);
background-repeat: no-repeat;
padding-left: 40px;
cursor: hand;
}
.submenu {
padding-left: 24px;
}
.file {
background-image: url(ie.gif);
background-repeat: no-repeat;
padding-left: 18px;
cursor: hand;
}
-->
</style>
</head><body>
<table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="emenu" onMouseUp="with(findObj('blue'))if(style.display=='none'){style.display='';this.style .backgroundImage='url(c.gif)'}else{style.display='none';this.style .backgroundImage='url(e.gif)'}">blue</td>
</tr>
<tr id="blue">
<td class="submenu"><table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="emenu"onMouseUp="with(findObj('a'))if(style.display=='none'){style.display='';this.style .backgroundImage='url(c.gif)'}else{style.display='none';this.style .backgroundImage='url(e.gif)'}">a</td>
</tr>
<tr id="a">
<td class="submenu"><table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="file">b</td>
</tr>
<tr>
<td class="file">c</td>
</tr>
<tr>
<td class="file">d</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td class="emenu" onMouseUp="with(findObj('flash'))if(style.display=='none'){style.display='';this.style .backgroundImage='url(c.gif)'}else{style.display='none';this.style .backgroundImage='url(e.gif)'}">flash</td>
</tr>
<tr id="flash">
<td class="submenu"><table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="file">v</td>
</tr>
<tr>
<td class="file">h</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<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>
<title>无标题文档</title>
<style type="text/css">
<!--
.emenu {
background-image: url(e.gif);
background-repeat: no-repeat;
padding-left: 40px;
cursor: hand;
}
.submenu {
padding-left: 24px;
}
.file {
background-image: url(ie.gif);
background-repeat: no-repeat;
padding-left: 18px;
cursor: hand;
}
-->
</style>
</head><body>
<table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="emenu" onMouseUp="with(findObj('blue'))if(style.display=='none'){style.display='';this.style .backgroundImage='url(c.gif)'}else{style.display='none';this.style .backgroundImage='url(e.gif)'}">blue</td>
</tr>
<tr id="blue">
<td class="submenu"><table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="emenu"onMouseUp="with(findObj('a'))if(style.display=='none'){style.display='';this.style .backgroundImage='url(c.gif)'}else{style.display='none';this.style .backgroundImage='url(e.gif)'}">a</td>
</tr>
<tr id="a">
<td class="submenu"><table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="file">b</td>
</tr>
<tr>
<td class="file">c</td>
</tr>
<tr>
<td class="file">d</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td class="emenu" onMouseUp="with(findObj('flash'))if(style.display=='none'){style.display='';this.style .backgroundImage='url(c.gif)'}else{style.display='none';this.style .backgroundImage='url(e.gif)'}">flash</td>
</tr>
<tr id="flash">
<td class="submenu"><table width="200" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="file">v</td>
</tr>
<tr>
<td class="file">h</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
解决方案 »
- 火狐和chome都用类似onpropertychange的回调要怎么做?
- Ext DateField 选择月份的bug
- parent.document.getElementById("main").src中的parent是什么意思?
- 关于JS导出文件的问题,还请熟悉的人帮帮忙,进来看看
- js 如何判断某个ocx是否注册?
- JavaScript 里 switch 怎么按照 id 选择case呀?!..
- 表单生成单号问题
- 写了一个超简单的js,可是不知道怎么调用
- 谁有好点的javascript Menu类,我这知道一个但不支持中文,有愿意接受挑战的试试改成支持中文的。
- 老问题,请问,如果设置弹出的窗口什么也没有(status,toolbar,menubar,scrollbars,location,titlebar)
- js控制最初画面
- 网站高耗cpu,求解
<tr id="blue" style=" display:none;">
这样不就行了嘛。。
http://www.isouji.cn/MaterialType.aspx?type=8