下面各举一例,
鼠标悬浮触发:(此例ie6下无效,因其暂不支持li:hover的伪类)
<!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">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<title>纯CSS下拉菜单</title>
<style type="text/css">
a{
font-size:12px
text-decoration:none
color:#000000}
li ul{
display:none
margin-left:5px}
li:hover ul{
width:306px
padding:20px
height:250px
display:block
}
li:hover .fira{border-bottom:#FFFFFF 1px solid
}#kpk{
position:relative
width:420px
}
#kpk>li{
float:left
list-style:none
margin-right:20px
}
#kpk>li .fira{
border:1px #c6c6c6 solid
}
.seca{
position:absolute
z-index:1
left:-5px
top:23px
border:1px #c6c6c6 solid
height:250px
width:306px
padding:20px
height:250px
}
.fira{
width:70px
display:block
line-height:22px
background-color:white
text-align:center
z-index:2
}</style>
</head><body>
<div>
<ul id="kpk">
<li>
<a href="#" class="fira">首页</a>
<ul class="seca" rel="first">
<li><A href="#" target=_self>1.首页新疆阜康铁路桥梁坍塌多节运煤车厢侧翻坠河</A></li>
<li><A href="#" target=_self>2.首页最高法:承诺不判赖昌星死刑没有超越法律程序</A></li>
<li><A href="#" target=_self>3.首页物权法:满70年住宅建设用地使用权将自动续期</A></li>
<li><A href="#" target=_self>4.首页弟弟被妻下药毒死男子买女尸为其配阴婚(图)</A></li>
<li><A href="#" target=_self>5.首页揭开郑州神枪手神秘面纱 头号狙击手是近视眼</A></li>
<li><A href="#" target=_self>6.首页美军高官:不排除和中国发生直接军事对抗可能</A></li>
<li><A href="#" target=_self>7.首页浙江东阳传奇富姐吴英涉嫌非法吸收存款被批捕</A></li>
<li><A href="#" target=_self>8.首页西方炒作"中国航母威胁论"称05年已正式服役</A></li>
<li><A href="#" target=_self>9.首页女孩生活无法自理请人大代表递交安乐死议案</A></li>
<li><A href="#" target=_self>10.首页建设部:住房公积金制度将覆盖农民工</A></li>
</ul>
<!--<ul>
<li>11</li>
<li>12</li>
<li>13</li>
</ul>-->
</li>
<li>
<a href="#" class="fira">链接一</a>
<ul class="seca">
<li><A href="#" target=_self>1.链接一新疆阜康铁路桥梁坍塌多节运煤车厢侧翻坠河</A></li>
<li><A href="#" target=_self>2.链接一最高法:承诺不判赖昌星死刑没有超越法律程序</A></li>
<li><A href="#" target=_self>3.链接一物权法:满70年住宅建设用地使用权将自动续期</A></li>
<li><A href="#" target=_self>4.链接一弟弟被妻下药毒死男子买女尸为其配阴婚(图)</A></li>
<li><A href="#" target=_self>5.链接一揭开郑州神枪手神秘面纱 头号狙击手是近视眼</A></li>
<li><A href="#" target=_self>6.链接一美军高官:不排除和中国发生直接军事对抗可能</A></li>
<li><A href="#" target=_self>7.链接一浙江东阳传奇富姐吴英涉嫌非法吸收存款被批捕</A></li>
<li><A href="#" target=_self>8.链接一西方炒作"中国航母威胁论"称05年已正式服役</A></li>
<li><A href="#" target=_self>9.链接一女孩生活无法自理请人大代表递交安乐死议案</A></li>
<li><A href="#" target=_self>10.链接一建设部:住房公积金制度将覆盖农民工</A></li>
</ul>
<!--<ul>
<li>21</li>
<li>22</li>
<li>23</li>
</ul>-->
</li>
<li>
<a href="#" class="fira">链接二</a>
<ul class="seca">
<li><A href="#" target=_self>1.链接二新疆阜康铁路桥梁坍塌多节运煤车厢侧翻坠河</A></li>
<li><A href="#" target=_self>2.链接二最高法:承诺不判赖昌星死刑没有超越法律程序</A></li>
<li><A href="#" target=_self>3.链接二物权法:满70年住宅建设用地使用权将自动续期</A></li>
<li><A href="#" target=_self>4.链接二弟弟被妻下药毒死男子买女尸为其配阴婚(图)</A></li>
<li><A href="#" target=_self>5.链接二揭开郑州神枪手神秘面纱 头号狙击手是近视眼</A></li>
<li><A href="#" target=_self>6.链接二美军高官:不排除和中国发生直接军事对抗可能</A></li>
<li><A href="#" target=_self>7.链接二浙江东阳传奇富姐吴英涉嫌非法吸收存款被批捕</A></li>
<li><A href="#" target=_self>8.链接二西方炒作"中国航母威胁论"称05年已正式服役</A></li>
<li><A href="#" target=_self>9.链接二女孩生活无法自理请人大代表递交安乐死议案</A></li>
<li><A href="#" target=_self>10.链接二建设部:住房公积金制度将覆盖农民工</A></li>
</ul>
<!--<ul>
<li>31</li>
<li>32</li>
<li>33</li>
</ul>-->
</li>
<li>
<a href="#" class="fira">链接三</a>
<ul class="seca">
<li><A href="#" target=_self>1.链接三新疆阜康铁路桥梁坍塌多节运煤车厢侧翻坠河</A></li>
<li><A href="#" target=_self>2.链接三最高法:承诺不判赖昌星死刑没有超越法律程序</A></li>
<li><A href="#" target=_self>3.链接三物权法:满70年住宅建设用地使用权将自动续期</A></li>
<li><A href="#" target=_self>4.链接三弟弟被妻下药毒死男子买女尸为其配阴婚(图)</A></li>
<li><A href="#" target=_self>5.链接三揭开郑州神枪手神秘面纱 头号狙击手是近视眼</A></li>
<li><A href="#" target=_self>6.链接三美军高官:不排除和中国发生直接军事对抗可能</A></li>
<li><A href="#" target=_self>7.链接三浙江东阳传奇富姐吴英涉嫌非法吸收存款被批捕</A></li>
<li><A href="#" target=_self>8.链接三西方炒作"中国航母威胁论"称05年已正式服役</A></li>
<li><A href="#" target=_self>9.链接三女孩生活无法自理请人大代表递交安乐死议案</A></li>
<li><A href="#" target=_self>10.链接三建设部:住房公积金制度将覆盖农民工</A></li>
</ul>
<!--<ul>
<li>41</li>
<li>42</li>
<li>43</li>
</ul>-->
</li>
</ul>
</div>
</body>
</html>
锚点点击例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>左右布局</title>
<style type="text/css">
#nav{
width:303px
height:200px
border:1px solid #CCCCCC
}
#column a {
float:left
width:100px
border-right:1px solid #CCC
border-bottom:1px solid #CCC
font:bold 14px/30px Arial, Helvetica, sans-serif
color:#000
text-decoration:none
text-align:center
}
#contant {
width:303px
height:162px
overflow:hidden
}
ul {
margin:0
padding:0
list-style-type:none
padding:4px 0 0 5px
}
li {
font-size:12px
overflow:hidden
padding-left:2px
line-height:27px
}
</style>
</head>
<body>
<div id="nav">
<div id="column"><a href="#localnew">本地新闻</a><a href="#innernew">国内新闻</a><a href="#enterment" >娱乐新闻</a></div>
<div id="contant">
<ul id="localnew">
<li><a href="#">我喜欢CSS </a></li>
<li><a href="#">我喜欢CSS </a></li>
<li><a href="#">我喜欢CSS </a></li>
<li><a href="#">我喜欢CSS </a></li>
<li><a href="#">我喜欢CSS</a></li>
<li><a href="#">我喜欢CSS</a></li>
</ul>
<ul id="innernew">
<li><a href="#">我喜欢编程</a></li>
<li><a href="#">我喜欢编程</a></li>
<li><a href="#">我喜欢编程</a></li>
<li><a href="#">我喜欢编程 </a></li>
<li><a href="#">我喜欢编程</a></li>
<li><a href="#">我喜欢编程</a></li>
</ul>
<ul id="enterment">
<li><a href="#">我喜欢美工</a></li>
<li><a href="#">我喜欢美工</a></li>
<li><a href="#">我喜欢美工</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>
</body>
</html>
楼主自行copy代码到本地查看,样式微调。。。
<!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">
<head>
<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>滑动门通用JS代码</title>
<style type="text/css">
<!--
body{margin:0pxpadding:0pxfont-size:12pxbackground:#eeeline-height:20px}
.bodyer{width:760pxmargin:20px auto autoborder:1px dotted #cccbackground:#fff}
.t_rt{text-align:right}
h1,h2,h3,h4,h5,h6{font-weight:boldmargin:0pxpadding:0pxfont-size:12px}
ul,li{margin:0pxpadding:0px}
li{list-style-type:none}
h1{margin:10pxpadding-right:10pxpadding-bottom:5pxborder-bottom:1px dotted #ccc}
.preview{margin:10pxpadding:10pxoverflow:hiddenbackground:#eee}
.cont{padding:10px}
.cls{clear:both}
.hidden{display:none}
#sourse{border:1px dotted #cccwidth:600pxheight:300pxmargin:0px auto}
.textDiv{margin:10px 40px 10pxtext-align:center}
h2{margin:0px 10pxbackground:#cccpadding:5px}
.example{margin:10pxbackground:#FFFborder:1px dotted #cccpadding:10px}
.scrolldoorFrame{width:400pxmargin:0px autooverflow:hidden}
.scrollUl{width:400pxborder-bottom:1px solid #CCCoverflow:hiddenheight:35px}
.scrollUl li{float:left}
.bor03{border:1px solid #cccborder-top-width:0px}
.sd01{cursor:pointerborder:1px solid #CCCbackground:#FFFmargin:5pxpadding:2pxfont-weight:bold}
.sd02{cursor:pointerborder:0px solid #CCCmargin:5pxpadding:2px}
-->
</style>
<script type="text/javascript">
function scrollDoor(){
}//scrollDoor.prototype = {
sd : function(menus,divs,openClass,closeClass){
var _this = this
if(menus.length != divs.length)
{
alert("菜单层数量和内容层数量不一样!")
return false
}//for(var i = 0 i <menus.length i++)
{
_this.$(menus[i]).value = i
_this.$(menus[i]).onmouseover = function(){
for(var j = 0 j <menus.length j++)
{
_this.$(menus[j]).className = closeClass
_this.$(divs[j]).style.display = "none"
}
_this.$(menus[this.value]).className = openClass
_this.$(divs[this.value]).style.display = "block"
}
}
},
$ : function(oid){
if(typeof(oid) == "string")
return document.getElementById(oid)
return oid
}
}//
window.onload = function(){
var SDmodel = new scrollDoor()
SDmodel.sd(["m01","m02","m03","m04","m05"],["c01","c02","c03","c04","c05"],"sd01","sd02")
SDmodel.sd(["mm01","mm02","mm03","mm04","mm05"],["cc01","cc02","cc03","cc04","cc05"],"sd01","sd02")
SDmodel.sd(["mmm01","mmm02","mmm03","mmm04","mmm05"],["ccc01","ccc02","ccc03","ccc04","ccc05"],"sd01","sd02")
}//
</script>
</head>
<body>
<a href="##/">站长特效网</a>,站长必备的高质量网页特效和广告代码。站长js特效。<hr>
<div class="bodyer">
<h1 class="t_rt">
滑动门封装类
</h1>
<h2>
效果预览
</h2>
<div class="preview">
<div class="scrolldoorFrame">
<ul class="scrollUl">
<li class="sd01" id="m01">滑动门</li>
<li class="sd02" id="m02">滑动门</li>
<li class="sd02" id="m03">滑动门</li>
<li class="sd02" id="m04">滑动门</li>
<li class="sd02" id="m05">滑动门</li>
</ul>
<div class="bor03 cont">
<div id="c01">
站长特效一号内容
</div>
<div id="c02" class="hidden">
站长特效二号内容
</div>
<div id="c03" class="hidden">
站长特效三号内容
</div>
<div id="c04" class="hidden">
站长特效四号内容
</div>
<div id="c05" class="hidden">
站长特效五号内容
</div>
</div>
</div>
</div>
<div class="preview">
<div class="scrolldoorFrame">
<ul class="scrollUl">
<li class="sd01" id="mm01">滑动门</li>
<li class="sd02" id="mm02">滑动门</li>
<li class="sd02" id="mm03">滑动门</li>
<li class="sd02" id="mm04">滑动门</li>
<li class="sd02" id="mm05">滑动门</li>
</ul>
<div class="bor03 cont">
<div id="cc01">
站长特效一号内容
</div>
<div id="cc02" class="hidden">
站长特效二号内容
</div>
<div id="cc03" class="hidden">
站长特效三号内容
</div>
<div id="cc04" class="hidden">
站长特效四号内容
</div>
<div id="cc05" class="hidden">
站长特效五号内容
</div>
</div>
</div>
</div>
<div class="preview">
<div class="scrolldoorFrame">
<ul class="scrollUl">
<li class="sd01" id="mmm01">滑动门</li>
<li class="sd02" id="mmm02">滑动门</li>
<li class="sd02" id="mmm03">滑动门</li>
<li class="sd02" id="mmm04">滑动门</li>
<li class="sd02" id="mmm05">滑动门</li>
</ul>
<div class="bor03 cont">
<div id="ccc01">
站长特效一号内容
</div>
<div id="ccc02" class="hidden">
站长特效二号内容
</div>
<div id="ccc03" class="hidden">
站长特效三号内容
</div>
<div id="ccc04" class="hidden">
站长特效四号内容
</div>
<div id="ccc05" class="hidden">
站长特效五号内容
</div>
</div>
</div>
</div>
</div>
</body>
</html>
自己贴下来运行一下!