»
EnglishFrenchVietnamese

Print - Drag and Drop Images - JavaScriptBank.com

Full version: jsB@nk » Image » Drag and Drop Images
URL: https://www.javascriptbank.com/drag-and-drop-images.html

Drag and Drop Images © JavaScriptBank.comThis cross-browser drag'n'drop demonstration adds a nice dragging effect to the image.

Full version: jsB@nk » Image » Drag and Drop Images
URL: https://www.javascriptbank.com/drag-and-drop-images.html



HTML
<DIV id=1 style="LEFT: 50px; POSITION: absolute; TOP: 50px"><IMG src="photo5.jpg" name=1></DIV><DIV id=2 style="LEFT: 200px; POSITION: absolute; TOP: 200px"><IMG src="logojs.gif" name=1 width="382" height="201"></DIV><SCRIPT language=javascript>Wholething = (document.all) ? 0 : 1;var objectone;function MouseMovement(e)  {if (objectone) {if (Wholething) {objectone.moveTo((e.pageX-X), (e.pageY-Y)); }else {objectone.pixelLeft = event.clientX-X + document.body.scrollLeft;objectone.pixelTop = event.clientY-Y + document.body.scrollTop;return false; } } }function MouseClickUp() {objectone = null; }if (Wholething)  {document.captureEvents(Event.mousedown | Event.mousemove | Event.mouseup); }function MouseClickDown(e) {if (Wholething) {objectone = document.layers[e.target.name];X=e.x;Y=e.y;return false; }else {objectone = event.srcElement.parentElement.style;X=event.offsetX;Y=event.offsetY; } }document.onmouseup = MouseClickUp;document.onmousedown = MouseClickDown;document.onmousemove = MouseMovement;</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->