<style type="text/css"> *{ margin:0px auto; padding:0px;} #kuang{ width:500px; height:5px; border:1px solid #000; margin-top:20px;} #zou{ height:5px; float:left; background-color:#000} </style> </head> <body> <div id="kuang"> <div id="zou" style=" width:0px;"></div> </div> </body> <script type="text/javascript"> window.setTimeout("zou()",50); function zou() { var kuandu = document.getElementById("zou"); var str = kuandu.style.width; var cd = str.substr(0,str.length-2); if(cd<500) { var cd= parseInt(cd)+5; kuandu.style.width=cd+"px" window.setTimeout("zou()",30); } } </script>