a标签

来源:互联网 发布:淘宝电子商务公司起名 编辑:程序博客网 时间:2024/05/16 04:21



有些页面模板 实现了掠过改变样式(比如高亮),点击改变样式 效果。


实现如下:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>鼠标移到导航上面 当前的LI变色 处于当前的位置</title>
<style type="text/css">
ul,li{list-style:none;}
#nav li{display:inline-block;margin:0 5px;background:#ccc;padding:0 10px; line-height:24px;font-size:12px;}
#nav li.h_nav_over{background:red;color:#fff;}
#nav li.h_nav_over a{color:#fff;}
a{text-decoration:none;}


.level a.light{background:SkyBlue   ;color:#fff;}
.level a.clicked_{background:red  ;color:#eee;}


</style>
<script type="text/javascript" src="http://jt.875.cn/js/jquery.js"></script>
<script type = "text/javascript" >

function firstShow(){
$(".firstChilds").toggle();
}
function secondShow(){
$(".secondChild").toggle();
}
function thirdShow(){
$(".thirdChilds").toggle();
}



 $(function() {
$("#nav>ul>li").mouseover(function() {
//$("#nav>ul>li").each(function(i) {
// var children  = this.childNodes;
// $(this).removeClass("h_nav_over");
//});
$(this).addClass("h_nav_over");
//$(this).trigger('click');
}).mouseout(function() {
$(this).removeClass("h_nav_over");
});
$(".level a").mouseover(function(){
$(".level a").each(function(i) {
$(this).removeClass("clicked_");
});
//console.info($(this));
$(this).addClass("light");
}).mouseout(function() {
$(this).removeClass("light");
}).click(function(){
$(".level a").each(function(i) {
$(this).removeClass("light");
$(this).removeClass("clicked_");
});
$(this).addClass("clicked_");
console.info($(this));
return false;
});
}); </script>
</head>
<body>
<div id="nav">
<ul>
<li><a href="http://www.baidu.com" target="_blank">首页</a></li>
<li><a href="http://www.163.com/" >品牌商机</a></li>
<li><a href="#">精品商机 </a></li>
<li><a href="#">最新商机 </a></li>
<li><a href="#">投资考察会</a></li>
<li><a href="#">在线交流区</a></li>
</ul>
</div>


<div id="Menu">
<ul id="MenuUL" style="list-style:none">
<li id="caseUser" class="level" >
<br><br>
<a href="" target="main" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第1个页签 </font></a><br>
</li> 
<li id="caseAdmin" class="level">
<br><br>
<a  href="" target="main"  style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第2个页签  </font></a><br>
</li>
<li id="messageBook" class="level">
<br><br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第3个页签  </font></a><br>
</li>
<li id="securityManager" class="level">
<br><br>
<a href="javascript:void(0)" target="main" align="left" style="text-decoration:none;color: black;" onclick="firstShow()" ><font style="font-size:15px;font-weight: bold;">第4个页签  </font></a><br>
<ul style="list-style:none">
<li class="firstChilds" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第41个页签  </font> </a><br>
</li>
<li class="firstChilds" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第42个页签  </font> </a><br>
</li>
<li class="firstChilds" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第43个页签</font> </a><br>
</li>
<li class="firstChilds" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第44个页签</font> </a><br>
</li>
</ul>
</li>
<li id="smsQuery" class="level">
<br><br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;" ><font style="font-size:15px;font-weight: bold;">第5个页签  </font> </a><br>
</li>
<li id="dataExportManager" class="level">
<br><br>
<a href="javascript:void(0)" target="main" align="left" style="text-decoration:none;color: black;" onclick="secondShow()" ><font style="font-size:15px;font-weight: bold;">第6个页签 </font> </a><br>
<ul style="list-style:none">
<li class="secondChild" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第61个页签</font> </a><br>
</li>
<li class="secondChild" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第62个页签</font> </a><br>
</li>
<li class="secondChild" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第63个页签</font> </a><br>
</li>
</ul>
</li>
<li id="caseUser_outPack" class="level">
<br><br>
<a href="javascript:void(0)" target="main" align="left" style="text-decoration:none;color: black;" onclick="thirdShow()" ><font style="font-size:15px;font-weight: bold;">第7个页签 </font></a><br>
<ul style="list-style:none">
<li class="thirdChilds" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第71个页签 </font> </a><br>
</li>
<li class="thirdChilds" class="level">
<br>
<a href="" target="main" align="left" style="text-decoration:none;color: black;"><font style="font-size:15px;font-weight: bold;">第72个页签</font> </a><br>
</li>
</ul>
</li>
</ul>
</div>  
</body>
</html>



官方文档

http://www.w3school.com.cn/tags/tag_a.asp

http://www.runoob.com/tags/tag-a.html


原创粉丝点击