<html xmlns:v="urn:schemas-microsoft-com:vml"> <STYLE> 
v\:* { Behavior: url(#default#VML) } 
</STYLE> 
<head> 
<title>mytest </title> 
<script  type= "text/javascript" > 
var mouseCoord;//定义一个全局变量 
//下面的函数求得鼠标在div中的坐标 
function getMouseCoord(){ 
e=window.event; 
tempx=event.x;
tempy=event.y;
mouseX=parseInt(tempx-form1.offsetLeft-8); 
mouseY=parseInt(tempy-td2.offsetHeight-td1.offsetHeight-8-form1.offsetTop); 
mouseCoord={x:mouseX,y:mouseY}; 
return mouseCoord; 

// 鼠标移动时触发这个函数,在这个函数的内部调用上面的函数返回鼠标的坐标,即时的将坐标传给id为coord的text 
function onmousemovehandler(){ 
tempmousecoord=getMouseCoord(); 
coord.value=tempmousecoord.x+","+tempmousecoord.y; 

</script> 
</head> 
<body oncontextmenu='return false'> <table cellspacing=0 cellpadding=3 width=770 align=center style='border-right:3 solid grey;border-left:3 solid grey;border-top:3 solid grey;border-bottom:3 solid grey' id=form1> 
  <tbody> 
    <tr align=center bgcolor="#33CCFF" id=tr1 > 
      <td id=td1 height=6> <input type="button"  id=drawline value='测距'> 
        <input type="button"  id=clear value='清除'> 
      </td> 
    </tr> 
    <tr align=center bgcolor="#33CCFF" > 
      <td width="660" id=td2 height=6> X Y 坐标 
        <input disabled='true' type='text' value='0,0' id='coord' style='border:1 solid black;width:50;height:17;'> 
        起点坐标 
        <input disabled='true' type='text' value='0,0' id='startCoord' style='border:1 solid black;width:50;height:17;'> 
        终点坐标 
        <input name="text" type='text' disabled='true' id='endCoord' style='border:1 solid black;width:50;height:17;' value='0,0' /> 
      </td> 
    </tr> 
    <tr align=center > 
      <td height="400" width="770" > 
  <div style='width:760;height:100%;border:1  red;color:black;'  id=div1  onMouseMove=onmousemovehandler()> </div> 
  </td> 
    </tr> 
  </tbody> 
</table> 
</body> 
</html> 已经给你改过了,“mouseCoord={x:mouseX y:mouseY};” 应该改为“mouseCoord={x:mouseX ,y:mouseY};”你少了一个逗号。
下回细心点。呵呵