第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

javascript 為什么在運動框架中不能實現(xiàn)borderWidth的變化,我的代碼如下請指教:

javascript 為什么在運動框架中不能實現(xiàn)borderWidth的變化,我的代碼如下請指教:

慕虎5948952 2016-08-18 15:47:24
<!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=gb2312" /><title>邊框運動</title><style>div{width:100px; height:100px; margin:20px; float:left; background:yellow; border:2px solid green;??? filter:alpha(opacity=30); ?????? opacity:0.3; ?}</style><script>function getStyle(obj,name){?? ?if(obj.currentStyle){?? ??? ?return obj.currentStyle[name]}else{?? ??? ??? ?return getComputedStyle(obj,false)[name];?? ??? ??? ?}?? ??? ??? ?}window.onload=function(){?? ?var aDiv1=document.getElementById('div1');?? ??;?? ??var oTxt=document.getElementById('txt');aDiv1.onmouseover=function(){?? ?startMove(this,'borderWidth',100);?? ?}aDiv1.onmouseout=function(){ ?? ?startMove(this,'borderWidth',30);?? ?}/*aDiv1.onmouseover=function(){?? ??? ?startMove(this,'width',400);?? ?}aDiv1.onmouseout=function(){ ?? ?startMove(this,'width',100);?? ?}*/?? ?}?? ?function startMove(obj,attr,iTarget){?? ??? ?clearInterval(obj.timer);?? ?obj.timer=setInterval(function(){?? ??? ??? ??? ?var cur=parseInt(getStyle(obj,attr))?? ??? ?if(attr=='opacity'){?? ??? ??? ?cur=parseFloat(getStyle(obj,attr))*100;?? ??? ??? ?}else{?? ??? ??? ??? ?cur=parseInt(getStyle(obj,attr));?? ??? ??? ??? ??? ??? ??? ??? ?}?? ??? ?var speed=(iTarget-cur)/4;?? ??? ?speed=speed>0?Math.ceil(speed):Math.floor(speed);?? ?if(cur==iTarget){?? ?clearInterval(obj.timer);}?? ?else{?? ??? ?if(attr=='opacity'){?? ??? ?obj.style.filter='alpha(opacity:'+cur+speed+')';?? ??? ?obj.style.opacity=(cur+speed)/100;?? ??? ??? ?var oTxt=document.getElementById('txt'); ?? ??? ?oTxt.value=?? ?obj.style.opacity;?? ??? ??? ??? ??? ??? ??? ?}else{?? ?obj.style[attr]=cur+speed+'px';?? ?var oTxt=document.getElementById('txt');?? ?oTxt.value=?? ?cur+speed;}?? ??? ?}?? ??? ??? ??? ?},30)?? ??? ?}</script></head><body><input id='txt' type="text" /><div id='div1'>邊框運動</div></body></html>
查看完整描述

1 回答

?
stone310

TA貢獻361條經(jīng)驗 獲得超191個贊

代碼在chrome和IE下可以正常執(zhí)行的,火狐由于不支持borderWidth這么寫,要求更嚴(yán)謹(jǐn)?shù)膶懛ǎ?/p>

border-left-width ,border-top-width ,border-right-width ,?border-bottom-width,

所以先建議你把運動框架改成完美運動框架(就是將attr和iTarget兩個參數(shù),變成json模式),具體可找找教程,網(wǎng)上很多,慕課應(yīng)該也有

然后再寫邊框運動就寫上面4個屬性都變化(所有瀏覽器都能兼容)

以后就記得了,寫邊框運動比較麻煩點

查看完整回答
反對 回復(fù) 2016-08-19
  • 1 回答
  • 0 關(guān)注
  • 1360 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號