<Html><Head><title>能用鼠标拖放的图片</title></Head><Body bgColor="#ffffff" onload="init()"> <SCRIPT language=JavaScript>drag = 0move = 0function 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;" style="HEIGHT: 90px; LEFT: 200px; POSITION: absolute; TOP: 50px; WIDTH: 90px;background-color:red"></div><DIV onmouseout=drag=0 onmouseover="dragObj=this; drag=1;" style="HEIGHT: 90px; LEFT: 200px; POSITION: absolute; TOP: 170px; WIDTH: 90px;background-color:orange"></div><DIV onmouseout=drag=0 onmouseover="dragObj=this; drag=1;" style="HEIGHT: 90px; LEFT: 200px; POSITION: absolute; TOP: 290px; WIDTH: 90px;background-color:blue"></div></Body></Html>
当我们 加载图片在div上面的时候 作用就好看见了
有一定使用意义