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

為了賬號安全,請及時綁定郵箱和手機立即綁定

哪里錯啦?老是報ReferenceError: attr is not defined這個,我上次錯了別的語法也這么報,估計是其他原因?qū)懥薬ttr沒問題

<script src="test.js"></script>
?? ??? ?<script type="text/javascript">
?? ??? ??? ?window.onload=function(){
?? ??? ??? ??? ?var li=document.getElementById("li1");
?? ??? ??? ??? ?li.onmousemove=function(){
?? ??? ??? ??? ??? ?move(li,{width:300,height:300});
?? ??? ??? ??? ??? ?
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ??? ?//var json={a:1,b:2};
?? ??? ?</script>

function getstyle(obj,attr){
?? ??? ??? ??? ?if(obj.currentStyle){
?? ??? ??? ??? ??? ?return obj.currentStyle[attr];
?? ??? ??? ??? ?}else{
?? ??? ??? ??? ??? ?return getComputedStyle(obj,false)[attr];
?? ??? ??? ??? ?}
?? ??? ??? ?}
?? ??? ?var alpha=30;
?? ??? ?function move(obj,json,fn){
?? ??? ??? ?clearInterval(obj.timer);
?? ??? ??? ?obj.timer=setInterval(function(){
?? ??? ??? ??? ?for(var i in json){
?? ??? ??? ??? ??? ?var curr=0;
?? ??? ??? ??? ??? ?if(attr=="opacity"){
?? ??? ??? ??? ??? ??? ?curr = Math.round(parseFloat(getstyle(obj,attr))*100);
?? ??? ??? ??? ??? ?}else{
?? ??? ??? ??? ??? ???? curr=parseInt(getstyle(obj,attr));
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?//算速度
?? ??? ??? ??? ??? ?var speed=(json[attr]-curr)/8;
?? ??? ??? ??? ??? ?speed=speed>0?Math.ceil(speed):Math.floor(speed);
?? ??? ??? ??? ??? ?//檢測停止
?? ??? ??? ??? ??? ?if(curr==json[attr]){
?? ??? ??? ??? ??? ??? ?clearInterval(obj.timer);
?? ??? ??? ??? ??? ??? ?if(fn){
?? ??? ??? ??? ??? ??? ??? ?fn();
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}else{
?? ??? ??? ??? ??? ??? ?if(attr=="opacity"){
?? ??? ??? ??? ??? ??? ??? ?obj.style.filter="alpha(opacity:"+(curr+speed)+")";
?? ??? ??? ??? ??? ??? ??? ?obj.style.opacity=(curr+speed)/100;
?? ??? ??? ??? ??? ??? ?}else{
?? ??? ??? ??? ??? ??? ??? ?obj.style[attr]=curr+speed+"px";
?? ??? ??? ??? ??? ??? ?}
?? ??? ??? ??? ??? ?}
?? ??? ??? ??? ?}
?? ??? ??? ?},30)
?? ??? ?}

正在回答

1 回答

沒有attr呀~ 你代碼里的 應該把attr改為i,for循環(huán)里 json的屬性名。

1 回復 有任何疑惑可以回復我~
#1

慕仙5237505 提問者

非常感謝!啊,終于對了找了好久,謝謝
2017-11-03 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

哪里錯啦?老是報ReferenceError: attr is not defined這個,我上次錯了別的語法也這么報,估計是其他原因?qū)懥薬ttr沒問題

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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