請(qǐng)問(wèn)大佬們 這個(gè)代碼哪里錯(cuò)了``我檢查不出來(lái)
<!DOCTYPE html>
<html>
? ? <head>
? ? ? ? <meta charset="utf-8">
? ? ? ? <style type="text/css">
? ? ? ? ? ? *{
? ? ? ? ? ? ? ? margin:0;
? ? ? ? ? ? ? ? padding:0px;
? ? ? ? ? ? }
? ? ? ? ? ? ul{
? ? ? ? ? ? ? ? list-style: none;
? ? ? ? ? ? }
? ? ? ? ? ? li{
? ? ? ? ? ? ? ? width: 100px;
? ? ? ? ? ? ? ? height: 100px;
? ? ? ? ? ? ? ? background-color: yellow;
? ? ? ? ? ? ? ? margin-bottom: 15px;
? ? ? ? ? ? }
? ? ? ? </style>
? ? ? ? <script>
? ? ? ? window.onload=function(){
? ? ? ? ? ? var Li=document.getElementsByTagName('li');
? ? ? ? ? ? var timer;
? ? ? ? ? ? for(var i=0; i < Li.length;i++){
? ? ? ? ? ? ? ? Li[i].timer=null;
? ? ? ? ? ? ? ? Li[i],onmouseover=function(){
? ? ? ? ? ? ? ? ? ? ? ? smove(this,500);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Li[i].onmouseout=function(){
? ? ? ? ? ? ? ? ? ? ? ?smove( this,100);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? function smove(obj,target){
? ? ? ? ? ? ? ? clearInterval(obj.timer);
? ? ? ? ? ? ? ? obj.timer=setInterval(function(){
? ? ? ? ? ? ? ? var speed = (target-obj.offsetWidth)/2;
? ? ? ? ? ? ? ? speed=speed>0?Math.ceil(speed):Math.floor(speed);
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? ? ? if(obj.offsetWidth==target){
? ? ? ? ? ? ? ? ? ? ? ? ? ? clearInterval(obj.timer);
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? ? ? obj.style.width=obj.offsetWidth+speed+"px";
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? },30)
? ? ? ? }
? ? ? ? </script>
? ? </head>
? ? <body>
? ? <ul>
? ? ? ? <li></li>
? ? ? ? <li></li>
? ? ? ? <li></li>
? ? ? ? <li></li>
? ? ? ? <li></li>
? ? ? ? <li></li>
? ? ? ? <li></li>
? ? </ul>
? ? </body>
</html>
2017-05-18
Li[i].onmouseover中的‘.’被你寫成‘,’,逗號(hào)跟點(diǎn)的問(wèn)題確實(shí)比較難找出來(lái)