这是一个图片拖动功能
<%@ page contentType="text/html;charset=ISO8859_1" %> 
<html>
<title></title>
<script language="javascript">   var move=0,drag = 0, clickleft=0, clicktop=0, subFlag = 0;
   var dragObj= null;
    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 mouseMove() 
  {
    if (move) 
    {
        dragObj.style.left = window.event.x - clickleft
        dragObj.style.top = window.event.y - clicktop
        subFlag = 1;
    }
  }
  
  function mouseUp() 
  {
     move = 0
  alert(move)
     if(subFlag)
      form1.t.value =window.event.x + " " + window.event.y
     subFlag = 0
  }
  
  function mouseStop() 
  {
   window.event.returnValue = true
  }</script><body onload="init()">
<table> <tr>
    <td>
 <DIV id='image1' onmouseover='dragObj=image1; drag=1;' style='position:absolute; left:0px; top:50px;z-index:1'>
  <img src=a.jpg"  width="681" height="450"  /> 
 </DIV>
    </td>
 </tr> 
</table></body>
</html>为什么要ondragstart设置window.event.returnValue为false才可以正常拖动