<!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/html; charset=utf-8" />
<title>导航菜单</title>
<style type="text/css">
/***********课程代码************
* { margin: 0; padding: 0; font-size: 14px; }
a { color: #333; text-decoration: none }
ul { list-style: none; height: 30px; border-bottom: 5px solid #F60; margin-top: 20px; padding-left: 50px; }
ul li { float: left }
ul li a { display: block; height: 30px; text-align: center; line-height: 30px; width:120px; background: #efefef; margin-left: 1px; }
a.on, a:hover { background: #F60; color: #fff; }
*********************/
/******我的代码*******/
blockquote, body, button, dd, dl, dt, fieldset, form, h1, h2, h3, h4, h5, h6, hr, input, legend, li, ol, p, pre, td, textarea, th, ul {
padding: 0;
margin: 0;
font-size: 14px;
}
a {color: #706f6f;text-decoration: none;}
ul{list-style: none;height: 30px; border-bottom: 10px solid #ff6600;padding-left: 30px;margin-top: 20px;}
ul li{float: left;}
ul li a {display: block;height: 30px;line-height: 30px;width: 80px;background: #9BFFFF; text-align: center; margin-right: 1px;padding:0 5px 0;}
a.on,ul a:hover {background: #ff6600; color: #FFF;}
/****/
</style>
<script>
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.time);
var that=this;
that.time=setInterval(function(){
that.style.width=that.offsetWidth+8+"px";
if(that.offsetWidth >= 120){
clearInterval(that.time);
}
},30)
}
};
aA[i].onmouseout=function(){
if(this.className != "on"){
clearInterval(this.time);
var that=this;
this.time=setInterval(function(){
that.style.width=that.offsetWidth-8+"px";
if(that.offsetWidth <= 80){
that.style.width='80px';
clearInterval(that.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>