您好,登錄后才能下訂單哦!
<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上面的時候 作用就好看見了
有一定使用意義
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。