<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="gb2312" />
<meta name="author" content="RainoXu" />
<title></title>
</head>
<body>
<style type ="text/css">
/* <![CDATA[ */
body{
padding:0;
margin:0;
text-align:center;
}
#nav{
padding:0;
margin:0 auto;
width:900px;
height:29px;
list-style:none;
position:relative;
}
#nav li{
float:left;
text-align:center;
padding-left:4px;
/*IE6中讨厌的bug,在IE7和FireFox中不设宽度能自动适应内部元素的宽度,IE6不行=.=!!*/
+width:72px;
}
#nav li.highlight{
background:url("http://www.rainoina.com/raino/UserFiles/image/douban_nav/nav_bg_l.jpg") no-repeat left top;
}
#nav span a{
text-decoration:none;
font:14px tahoma;
display:block;
padding-right:9px;
padding-left:5px;
height:29px;
line-height:29px;
}
#nav li.highlight a{
background:url("http://www.rainoina.com/raino/UserFiles/image/douban_nav/nav_bg_r.jpg") no-repeat right top;
}
.subNav{
padding:0;
list-style:none;
width:900px;
height:30px;
background:#EEF9EB;
border-top:#DCF5D5;
display:none;
position:absolute;
left:0;
+left:-40px;
}
.highlight .subNav{
display:block;
}
.subNav li{
height:30px;
line-height:30px;
}
.subNav a{
text-decoration:none;
font:12px tahoma;
}
/* ]]> */
</style>
<ul>
<li>
<span><a href="###">菜单一</a></span>
<ul>
<li><a href="###">1子菜单一</a></li>
<li><a href="###">子菜单二</a></li>
<li><a href="###">子菜单三</a></li>
<li><a href="###">子菜单四</a></li>
</ul>
</li>
<li>
<span><a href="###">菜单二</a></span>
<ul>
<li><a href="###">2子菜单一</a></li>
<li><a href="###">子菜单二</a></li>
<li><a href="###">子菜单三</a></li>
<li><a href="###">子菜单四</a></li>
</ul>
</li>
<li>
<span><a href="###">菜单三</a></span>
<ul>
<li><a href="###">3子菜单一</a></li>
<li><a href="###">子菜单二</a></li>
<li><a href="###">子菜单三</a></li>
<li><a href="###">子菜单四</a></li>
</ul>
</li>
<li>
<span><a href="###">菜单四</a></span>
<ul>
<li><a href="###">4子菜单一</a></li>
<li><a href="###">子菜单二</a></li>
<li><a href="###">子菜单三</a></li>
<li><a href="###">子菜单四</a></li>
</ul>
</li>
</ul>
<script type="text/javascript">
//<![CDATA[
//定义一个控制NAV的类
function navSwap(navId){
this.obj=document.getElementById(navId);
this.subElement=[];
//把#navId的LI子节点(仅仅是子节点,不包括孙子节点)推入栈中
for (var i=0;i<this.obj.childNodes.length;i++){
if (this.obj.childNodes[i].nodeType==1){
this.subElement.push(this.obj.childNodes[i]);
}
}
if (this.subElement.length>0){
//首先将第一个标签选项高亮
this.subElement[0].className="highlight";
for (var i=0;i<this.subElement.length;i++){
//得到各个<span/>中的<a/>节点
var tagNode=this.subElement[i].getElementsByTagName("span")[0].getElementsByTagName("a")[0];
//绑定事件
tagNode.onmouseover=function(){
//得到#navId下的所有li,这里得到的也有来自subNav下的li,但这不影响后面的操作
var allSubTag=document.getElementById(navId).getElementsByTagName("li");
//找到class="highlight"的li,取消它的高亮,一旦找到就跳出循环
for (var j=0;j<allSubTag.length ;j++){
if (allSubTag[j].className=="highlight"){
allSubTag[j].className="";
break;
}
}
//这里的this指向的是onmouseover时触发者<span/>中的<a/>标签,而不是类的内部成员。
this.parentNode.parentNode.className="highlight";
}
}
}
}
//生成一个控制的对象
new navSwap("nav");
//]]>
</script>
</body>
</html>
Smilar Posts of JS menu
-
hibernate call stored procedure
hibernate call stored procedure
-
hibernate using c3p0 connection pooling
Private http://www.lifevv.com/tenyo/doc/20070605102040991.html c3p0 for open source's JDBC connection pool, with the release hibernate. This article describes how to use the hibernate configuratio ...
-
Hibernate configuration parameters hibernate.hbm2ddl.auto
Hibernate in the configuration file: Parameter Description: validate load hibernate, the authentication to create a database table structure create each load hibern ...
-
Build flex + spring + blazeds + hibernate application
Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the ...
-
Process migration from tomcat to websphere changes
Process migration from tomcat to websphere changes Because customers use the web application server software used by different what tomcat5, tomcat6, websphere5.1, websphere6.1, weblogic8, and so on, ...
-
Hibernate connection pool configuration
Hibernate connection pool configuration oracle.jdbc.driver.OracleDriver jdbc: oracle: thin: @ 10.203.14.132:1521: remotedb
-
hibernate generic generic DAO
hibernate generic generic DAO
-
Struts2 + hibernate + spring problem user log in
dao layer services layer action jsp user name: Password:
-
Hibernate secondary cache
Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml ...
-
Hibernate's lazy strategy
hibernate Lazy strategy can be used in: tag, it can be true / false Tags can values true / false type of necessary tools to enhance can tag values true / false / extra can be single-ended cor ...








Responses to “JS menu”