<html> 
<head> 
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "> 
<title> 新建网页   1 </title> 
<script> 
var   x=0; 
var   y=0;
var  top;
var left; 
function mousedown()
{
x=event.x; 
y=event.y; 
}
function mouseup()
{
top=document.all.div1.style.top; 
left=document.all.div1.style.left; 
document.all.div1.style.top=parseInt(top.substring(0,top.length-2))+(event.y-y); 
document.all.div1.style.left=parseInt(left.substring(0,left.length-2))+(event.x-x); 
y=event.y; 
x=event.x; 
}
</script> 
</head> 
<body   onmousemove= "mousemove()"> 
<div   id=div1   style= "position:absolute;top:100px;left:100px;width:100px;height:100px;background-color:#cccccc;cursor:hand"   onmousedown= " mousedown()"   onmouseup= "mouseup() ">
<img src="D:/项目/4.工程报废/S95标准测井曲线图(2).EMF">
</div> 
</body> 
</html> 

解决方案 »

  1.   


    <body onmousemove= "mousemove()">  
    这里的mousemove是调用js中自身的方法,就是执行mousemove方法
      

  2.   

    onmousemove 写个没有实现的方法,当然会报错的lz你的浏览器可能只是没报出来而已你可以试下<body onmousemove= "mousemove();alert(111);">还能够alert出来
      

  3.   

    lz是不是想这样啊
    <html>  
    <head>  
    <meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">  
    <title> 新建网页 1 </title>  
    <script>  
    var x=0;  
    var y=0;
    var top;
    var left;  
    var flag = false;
    function mousedown(){
    x=event.x;  
    y=event.y;  
    flag = true;
    }
    function mouseup(){
    flag = false;
    }
    function mousemove(){
    if(!flag) return;
    top=document.all.div1.style.top;  
    left=document.all.div1.style.left;  
    document.all.div1.style.top=parseInt(top.substring(0,top.length-2))+(event.y-y);  
    document.all.div1.style.left=parseInt(left.substring(0,left.length-2))+(event.x-x);  
    y=event.y;  
    x=event.x;  
    }
    </script>  
    </head>  
    <body>  
    <div id=div1 style= "position:absolute;top:100px;left:100px;width:100px;height:100px;background-color:#cccccc;cursor:hand" onmousedown= "mousedown()" onmouseup="mouseup()" onmousemove= "mousemove() ">
    <img src="D:/项目/4.工程报废/S95标准测井曲线图(2).EMF">
    </div>  
    </body>  
    </html>
      

  4.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var curLeft = 0;
    var curTop = 0;
    var curX = 0;
    var curY = 0;
    var bool = false;
    function show() {
    curLeft = document.getElementById("div1").style.pixelLeft;
    curTop = document.getElementById("div1").style.pixelTop;
    curX = event.clientX;
    curY = event.clientY;
    document.onmouseover = showDown;
    bool = true;
    } var curClientX = 0;
    var curClientY = 0;
    function showDown() {
    if (bool) {
    curClientX = event.clientX;
    curClientY = event.clientY;
    document.getElementById("div1").style.pixelLeft = curLeft + (curClientX - curX);
    document.getElementById("div1").style.pixelTop = curTop + (curClientY - curY);
    }
    }//-->
    </SCRIPT>
    </HEAD><BODY>
    <div id="div1" style= "position:absolute;top:100px;left:100px;width:100px;height:100px;background-color:#cccccc;cursor:hand;z-index:1;" onmousedown="show() " onmouseup= "bool = false">
    </div>  </BODY>
    </HTML>