| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 731 人关注过本帖
标题:页面打开时怎样使树状菜单呈展开状态?
只看楼主 加入收藏
xuexiyan
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-9-17
收藏
 问题点数:0 回复次数:3 
页面打开时怎样使树状菜单呈展开状态?

代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="../css_all.css" rel="stylesheet" type="text/css">
<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(../img/3.gif);
background-repeat: no-repeat;
padding-left: 30px;
cursor: hand;
}
.submenu {
padding-left: 16px;
cursor: hand;
}
.file {
background-image: url(../img/point_03.gif);
background-repeat: no-repeat;
padding-left: 13px;
cursor: hand;
background-position: left top;
}
.mainmenu {
background-image: url(../img/4.gif);
background-repeat: no-repeat;
padding-left: 30px;
cursor: hand;
}
-->
</style>
</head>

<body>
<table width="166" border="0" cellspacing="0" cellpadding="0">
<tr><td width="166" height="15"></td>
</tr>
<tr valign="top">
<td height="20" class="emenu" onmouseup="with(findObj('Blueidea').style){display=display=='none'?'':'none';this.style.backgroundImage=display!='none'?'url(../img/1.gif)':'url(../img/3.gif)'}">机构职能</td>
</tr>
<tr id="Blueidea" style="display:none">
<td class="submenu" height="75"><table height="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td height="19" class="file"><a href="#">司局领导</a></td>
</tr>
<tr valign="top">
<td height="22" class="file"><a href="01-2.html" target="change">主要职能</a></td>
</tr>
<tr valign="top">
<td height="28" valign="top" class="file"><a href="01.html" target="change">内设机构及联系<br/>
方式</a></td>
</tr>
</table></td>
</tr>
<tr valign="top">
<td height="20" class="emenu" onmouseup="with(findObj('zcfg').style){display=display=='none'?'':'none';this.style.backgroundImage=display!='none'?'url(../img/1.gif)':'url(../img/3.gif)'}">政策法规</td>
</tr>
<tr id="zcfg" style="display:none">
<td class="submenu" height="80"><table height="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td class="file">国内法规</td>
</tr>
<tr valign="top">
<td class="file">国外法规</td>
</tr>
<tr valign="top">
<td class="file">国内政策</td>
</tr>
<tr valign="top">
<td class="file">国外政策</td>
</tr>
</table></td>
</tr>
<tr valign="top">
<td height="20" class="emenu" onmouseup="with(findObj('xggg').style){display=display=='none'?'':'none';this.style.backgroundImage=display!='none'?'url(../img/1.gif)':'url(../img/3.gif)'}">相关公告</td>
</tr>
<tr id="xggg" style="display:none">
<td class="submenu" height="80"><table height="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td class="file">禁令公告</td>
</tr>
<tr valign="top">
<td class="file">警示通告</td>
</tr>
<tr valign="top">
<td class="file">动物疫情</td>
</tr>
<tr valign="top">
<td class="file">植物疫情</td>
</tr>
</table></td>
</tr>
<tr valign="top">
<td class="mainmenu" height="20">计划规划</td>
</tr>
<tr valign="top">
<td height="20" class="emenu" onmouseup="with(findObj('ywxx').style){display=display=='none'?'':'none';this.style.backgroundImage=display!='none'?'url(../img/1.gif)':'url(../img/3.gif)'}">业务信息</td>
</tr>
<tr id="ywxx" style="display:none">
<td class="submenu"><table border="0" cellpadding="0" cellspacing="0" valign="top">
<tr valign="top">
<td height="20" class="file"><a href="01dw/main.html" target="change">动物及其产品的检验<br/>检疫</a></td>
</tr>
<tr valign="top">
<td height="19" class="file"><a href="02sr/main.html" target="change">输入活动物的检疫</a></td>
</tr>
<tr valign="top">
<td height="30" class="file"><a href="03jj/main.html" target="change">进境动物遗传物质的<br/>检验检疫</a></td>
</tr>
<tr valign="top">
<td height="30" class="file"><a href="04jj/main.html" target="change">进境动物产品的检疫<br/>检疫</a></td>
</tr>
<tr valign="top">
<td height="20" class="file">出境活动物检验检疫</td>
</tr>
<tr valign="top">
<td height="26" class="file">出口动物产品检验检<br/>
疫</td>
</tr>
<tr valign="top">
<td height="21" class="file">生物制品检验检疫</td>
</tr>
<tr valign="top">
<td class="file">过境动物及其产品检<br/>验检疫</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

请问我怎样修改能使这个树状菜单在页面打开时称展开状态?谢谢~~~!!!!

搜索更多相关主题的帖子: 菜单 状态 页面 
2007-09-26 10:34
lmhllr
Rank: 8Rank: 8
等 级:贵宾
威 望:44
帖 子:1504
专家分:42
注 册:2005-5-12
收藏
得分:0 


<tr id="Blueidea" style="display:none">
把里面的none删掉,下面的也一样

PS:楼主的代码我运行不了:)

2007-09-26 11:26
xuexiyan
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2007-9-17
收藏
得分:0 
谢谢二楼的高手~!成功实现,可是菜单在闭合时图片是加号,展开后是减号。去掉“none”后展开也是加号呢~~
2007-09-26 11:35
lmhllr
Rank: 8Rank: 8
等 级:贵宾
威 望:44
帖 子:1504
专家分:42
注 册:2005-5-12
收藏
得分:0 
css里相对修改下啊。。。

因为没有你的图片我没调试的
2007-09-26 14:42
快速回复:页面打开时怎样使树状菜单呈展开状态?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022104 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved