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

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

onmousedown 和onmouseup應該在哪一段代碼中寫?

看程序中,?? oTitle.onmousedown=fnDown; ?是作用在login_logo_webqq這個DIV的, 按道理, 那么onmouseup也應該是作用在這個地方,為什么下面document.onmouseup是作用在document里面的事件? ?按道理, onmousedown和onmouseup是不是應該寫在一個函數里面的? 因為不可能一直是onmousedown的狀態啊

function drag() ?{

? ? var oTitle=getclass("login_logo_webqq","loginPanel")[0];

? ? oTitle.onmousedown=fnDown;

}


function fnDown(event){

? ? event=event||window.event;

? ?var ?oDrag=document.getElementById("loginPanel");

? ? ?disX=event.clientX-oDrag.offsetLeft,

? ? ?disY=event.clientY-oDrag.offsetTop;

? ? ? document.onmousemove=function(event) {?

? ? ? ? event=event||window.event;

? ? ? ? fnMove(event,disX,disY);?

? ? ? }


? ? ? ?document.onmouseup=function() {document.onmousemove=null;

? ? ? ?document.onmouseup=null;

? ? ? ?}

}


正在回答

1 回答

我看看試了課題里的代碼,把document改成otitle,效果實現的是一樣的,用document的話,可以不用再取一下那個otitle這變量,減少代碼的量。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

onmousedown 和onmouseup應該在哪一段代碼中寫?

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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