您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
<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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。