<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> </HEAD><BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- var ie=document.all; var nn6=document.getElementById&&!document.all; var isdrag=false; var y; var dobj;function movemouse(e) { if (isdrag) { dobj.style.top = nn6 ? ty + e.clientY - y : ty + event.clientY - y; return false; } }function selectmouse(e) { var fobj = nn6 ? e.target : event.srcElement; var topelement = nn6 ? "HTML" : "BODY"; while (fobj.tagName != topelement && fobj.className != "dragme") { fobj = nn6 ? fobj.parentNode : fobj.parentElement; } if (fobj.className=="dragme") { isdrag = true; dobj = fobj; //alert(dobj.id);显示被拖动图片的ID ty = parseInt(dobj.style.top+0); y = nn6 ? e.clientY : event.clientY; document.οnmοusemοve=movemouse; return false; } } document.οnmοusedοwn=selectmouse; document.οnmοuseup=new Function("isdrag=false"); //--> </SCRIPT><style>.dragme{position:relative;}</style> <img src="images/1.jpg" id="image1" class="dragme"> <img src="images/2.jpg" id="image2" class="dragme"> <img src="images/3.jpg" id="image3" class="dragme"></BODY> </HTML>