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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

關(guān)于這行代碼的解釋?誰幫幫我啊。在下跪求

關(guān)于這行代碼的解釋?誰幫幫我啊。在下跪求

慕粉3686312 2016-11-29 21:02:30
<!doctype?html> <html> <head> <meta?charset="utf-8"> <title>無標(biāo)題文檔</title> </head> <body> </body> </html> <!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=utf-8"?/> <title>移動(dòng)效果(按軌跡移動(dòng))</title> <style?type="text/css"> body,div{margin:0;padding:0;} div{position:absolute;width:66px;height:45px;background:url(img/1.gif)?no-repeat;top:100px;left:50px;} p,input{margin:10px;} </style> <script?type="text/javascript"> window.onload?=?function?() { ????var?oDiv?=?document.getElementsByTagName("div")[0]; ????var?aInput?=?document.getElementsByTagName("input"); ????var?oP?=?document.getElementsByTagName("p")[0]; ????var?i?=?0; ???? ????aInput[0].onclick?=?function?(event) ????{???????? ????????(event?||?window.event).cancelBubble?=?true; ????????clearEvent(); ????????this.value?+=?"(已激活)"; ????????oP.innerHTML?=?"鼠標(biāo)點(diǎn)擊頁面,?人物將移動(dòng)至鼠標(biāo)位置!"; ????????document.onclick?=?function?(event) ????????{ ????????????var?event?=?event?||?window.event; ????????????oDiv.style.background?=?"url(img/2.gif)?no-repeat"; ????????????startMove(oDiv,?{x:event.clientX,?y:event.clientY},?function(){oDiv.style.background?=?"url(img/1.gif)?no-repeat"}); ????????????return?false; ????????}???? ????}; ???? ????aInput[1].onclick?=?function?(event) ????{???????? ????????(event?||?window.event).cancelBubble?=?true; ????????clearEvent(); ????????this.value?+=?"(已激活)"; ????????oP.innerHTML?=?"按住鼠標(biāo)左鍵,在頁面劃動(dòng),人物將按照鼠標(biāo)軌跡移動(dòng)。" ????????var?aPos?=?[{x:oDiv.offsetLeft,?y:oDiv.offsetTop}]; ????????document.onmousedown?=?function?(event) ????????{ ????????????var?event?=?event?||?window.event;???????????? ????????????aPos.push({x:event.clientX,?y:event.clientY}); ????????????document.onmousemove?=?function?(event) ????????????{ ????????????????var?event?=?event?||?window.event; ????????????????aPos.push({x:event.clientX,?y:event.clientY});???? ????????????????return?false; ????????????} ????????????return?false; ????????} ????????document.onmouseup?=?function?() ????????{ ????????????document.onmousemove?=?null; ????????????oDiv.style.background?=?"url(img/2.gif)?no-repeat";???????? ????????????var?timer?=?setInterval(function?() ????????????{ ????????????????if(aPos.length?==?0) ????????????????{ ????????????????????clearInterval(timer); ????????????????????oDiv.style.background?=?"url(img/1.gif)?no-repeat"; ????????????????????return;???? ????????????????}; ????????????????oDiv.style.left?=?aPos[0].x?+?"px"; ????????????????oDiv.style.top?=?aPos[0].y?+?"px"; ????????????????aPos.shift(); ????????????},?30); ????????}; ????} ???? ????function?clearEvent() ????{ ????????document.onclick?=?null; ????????document.onmousedown?=?null; ????????document.onmousemove?=?null; ????????document.onmouseup?=?null; ????????for?(i?=?0;?i?<?aInput.length;?i++) ????????{ ????????????aInput[i].value?=?aInput[i].value.replace("(已激活)",?""); ????????????aInput[i].onmousedown?=?aInput[i].onmouseup?=?function?(event) ????????????{ ????????????????(event?||?window.event).cancelBubble?=?true;???? ????????????}; ????????} ????} }; function?startMove(obj,?oTarget,?fnEnd) { ????clearInterval(obj.timer); ????obj.timer?=?setInterval(function?() ????{ ????????doMove(obj,?oTarget,?fnEnd)???? ????},?30)???? } function?doMove(obj,?oTarget,?fnEnd) { ????var?iX?=?(oTarget.x?-?obj.offsetLeft)?/?5; ????var?iY?=?(oTarget.y?-?obj.offsetTop)?/?5; ????iX?=?iX?>?0???Math.ceil(iX)?:?Math.floor(iX); ????iY?=?iY?>?0???Math.ceil(iY)?:?Math.floor(iY); ????if?(oTarget.x?==?obj.offsetLeft?&&?oTarget.y?==?obj.offsetTop) ????{ ????????clearInterval(obj.timer); ????????fnEnd?&&?fnEnd();???? ????} ????else ????{ ????????obj.style.left?=?obj.offsetLeft?+?iX?+?"px"; ????????obj.style.top?=?obj.offsetTop?+?iY?+?"px";???? ????} } </script> </head> <body> <input?type="button"?value="根據(jù)鼠標(biāo)點(diǎn)擊位置移動(dòng)"?/><input?type="button"?value="根據(jù)標(biāo)鼠標(biāo)軌跡移動(dòng)"?/> <p>請(qǐng)點(diǎn)擊按鈕激活功能!</p> <div></div> </body> </html>var?aPos?=?[{x:oDiv.offsetLeft,?y:oDiv.offsetTop}]這個(gè)數(shù)組嘛?這行代碼與aPos.push({x:event.clientX,?y:event.clientY});之間是什么關(guān)系 或者是怎么運(yùn)行的呢?有什么作用啊 還有就是????????oDiv.style.left?=?aPos[0].x?+?"px"; ????????????????oDiv.style.top?=?aPos[0].y?+?"px"; 這兩行代碼是怎么運(yùn)行的?這個(gè)x,y表示的是數(shù)值嘛?求解答
查看完整描述

1 回答

?
一毛錢

TA貢獻(xiàn)156條經(jīng)驗(yàn) 獲得超57個(gè)贊

這個(gè)是數(shù)組,aPos是定義了一個(gè)數(shù)組

aPos.push()是向數(shù)組中添加元素

他們之間的關(guān)系是一個(gè)是定義數(shù)組,一個(gè)數(shù)組的方法(添加數(shù)組元素)

XY 指的是偏移XY軸的值

查看完整回答
反對(duì) 回復(fù) 2016-11-29
  • 慕粉3686312
    慕粉3686312
    var aPos = [{x:oDiv.offsetLeft, y:oDiv.offsetTop}]這個(gè){}里面表示的是一個(gè)數(shù)值呢,還是x,y分開數(shù)值呢? aPos[0].x這個(gè)是怎么取值的呢?取的是第一個(gè)數(shù)值, aPos[0].x=oDiv,offsetLeft???是不是這樣理解的呢?
  • 一毛錢
    一毛錢
    你應(yīng)該看看面向?qū)ο缶幊蘽}里面是一個(gè)對(duì)象。對(duì)象里面有兩個(gè)成員變量,這兩個(gè)的名字是XY,X的值是oDiv.offsetLeft Y的值是oDiv.offsetTop,怎么說呢{}就相當(dāng)于一個(gè)家,xy就相當(dāng)于你和你弟弟,后面的值就相當(dāng)于你的年齡
  • 慕粉3686312
    慕粉3686312
    那請(qǐng)問有沒有關(guān)于這方面的參考書或者教程???
  • 1 回答
  • 0 關(guān)注
  • 1450 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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