您好,登錄后才能下訂單哦!
<Html> <Head> <title>能用鼠標拖放的圖片</title> </Head> <Body bgColor="#ffffff" onload="init()"> <SCRIPT language=JavaScript> drag = 0 move = 0 function init() { window.document.onmousemove = mouseMove window.document.onmousedown = mouseDown window.document.onmouseup = mouseUp window.document.ondragstart = mouseStop } function mouseDown() { if (drag) { clickleft = window.event.x - parseInt(dragObj.style.left) clicktop = window.event.y - parseInt(dragObj.style.top) dragObj.style.zIndex += 1 move = 1 } } function mouseStop() { window.event.returnValue = false } function mouseMove() { if (move) { dragObj.style.left = window.event.x - clickleft dragObj.style.top = window.event.y - clicktop } } function mouseUp() { move = 0 } </SCRIPT> <DIV onmouseout=drag=0 onmouseover="dragObj=this; drag=1;" ></div> <DIV onmouseout=drag=0 onmouseover="dragObj=this; drag=1;" ></div> <DIV onmouseout=drag=0 onmouseover="dragObj=this; drag=1;" ></div> </Body> </Html>
當我們 加載圖片在div上面的時候 作用就好看見了
有一定使用意義
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。