<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>导航栏</title>
<style media="screen">
ul{
list-style: none;
width: 800px;
height:50px;
border-bottom: 5px solid rgb(14, 79, 126);
}
a{
text-align: center;
display: block;
width: 100px;
text-decoration: none;
font-family: 黑体;
color: rgb(0,0,0);
line-height: 30px;
font-size: 20px;
background: rgb(189, 108, 108);
padding: 5px;
border-top-right-radius: 8px;
border-top-left-radius: 8px;
}
/*a:hover,a.on{
background: rgb(29, 62, 122);
color:white;
width: 150px;
}*/
li{
float: left;
margin-top:10px;
}
</style>
<script type="text/javascript">
window.onload=function(){
var oNav=document.getElementsByTagName('ul')[0];
var aA=oNav.getElementsByTagName('a');
for(var i=0; i<aA.length; i++){
aA[i].onmouseover=function(){
if(this.className!="on"){
clearInterval(this.timer);
var This=this;
This.time=setInterval(function(){
This.style.width=This.offsetWidth+8+"px";
if(This.offsetWidth>=120)
clearInterval(This.time);
},30)
}
}
aA[i].onmouseout=function(){
if(this.className!="on"){
clearInterval(this.time);
var This=this;
this.time=setInterval(function(){
This.style.width=This.offsetWidth-8+"px";
if(This.offsetWidth<=80){
This.style.width='80px';
clearInterval(This.time);
}
},30)
}
}
}
}
</script>
</head>
<body>
<ul>
<li><a class="on" href="#">首    页</a></li>
<li><a href="#">新闻快讯</a></li>
<li><a href="#">产品展示</a></li>
<li><a href="#">售后服务</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</body>
</html>