亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我的為什么不能實現鏈式運動..找半天bug了

我的為什么不能實現鏈式運動..找半天bug了

朕的江山啊 2017-03-27 15:32:56
<!DOCTYPE html><html>?? ?<head>?? ??? ?<meta charset="UTF-8">?? ??? ?<title></title>?? ??? ?<style type="text/css">?? ??? ??? ?div{?? ??? ??? ??? ?width:100px;?? ??? ??? ??? ?height:50px;?? ??? ??? ??? ?background:yellow;?? ??? ??? ??? ?margin:20px;?? ??? ??? ??? ?margin-bottom:none;?? ??? ??? ?}?? ??? ?</style>?? ?</head>?? ?<script type="text/javascript">?? ??? ?window.onload = function(){?? ??? ??? ?var list=document.getElementsByTagName("div");?? ??? ??? ?for(var i=0 ; i<list.length ; i++){?? ??? ??? ??? ?list[i].tim=null;?? ??? ??? ??? ?list[i].onmouseover=function(){?? ??? ??? ??? ??? ?var g=this;?? ??? ??? ??? ??? ?change(this,"width",200,function(){?? ??? ??? ??? ??? ??? ?change(g,"height",100);?? ??? ??? ??? ??? ?});?? ??? ??? ??? ?}?? ??? ??? ??? ?list[i].onmouseout=function(){?? ??? ??? ??? ??? ?change(this,"width",100);?? ??? ??? ??? ?}?? ??? ??? ?}?? ??? ?}?? ??? ??? ??? ?function getAttr(obj,att){?? ??? ??? ?if(obj.currentStyle){?? ??? ??? ??? ?return obj.currentStyle[att];?? ??? ??? ?}else{?? ??? ??? ??? ?return getComputedStyle(obj,false)[att];?? ??? ??? ?}?? ??? ?}?? ??? ??? ??? ?function change(obj,att,iTarget,fn){?? ??? ??? ?var speed=null;?? ??? ??? ?clearInterval(obj.tim);?? ??? ??? ?obj.tim=setInterval(function(){?? ??? ??? ??? ?var geta=parseInt(getAttr(obj,att))?? ??? ??? ??? ?speed=(iTarget-geta)/20;?? ??? ??? ??? ?speed=speed>0?Math.ceil(speed):Math.floor(speed);?? ??? ??? ??? ?if(geta==iTarget){?? ??? ??? ??? ??? ?if(fn){?? ??? ??? ??? ??? ??? ?fn();?? ??? ??? ??? ??? ?}?? ??? ??? ??? ??? ?clearInterval(obj.tim);?? ??? ??? ??? ?}else{?? ??? ??? ??? ??? ?obj.style[att]=geta+speed+"px";?? ??? ??? ??? ?}?? ??? ??? ?},30)?? ??? ?}?? ?</script>?? ?<body>?? ??? ?<div id="d1">?? ??? ?</div>?? ??? ?<div id="">?? ??? ?</div>?? ??? ?<div id="">?? ??? ?</div>?? ?</body></html>
查看完整描述

1 回答

?
田心楓

TA貢獻1064條經驗 獲得超383個贊

你在這個要的什么效果 ?我看代碼沒問題啊

查看完整回答
反對 回復 2017-03-27
  • 1 回答
  • 0 關注
  • 929 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號