js代碼如下:
function PointDis() { var point1 = mxOcx.GetPoint(false,0,0,"\n 點取第一點:"); if(point1 == null) { alert("用戶取消"); return; } var point2 = mxOcx.GetPoint(true,point1.x,point1.y,"\n 點取第二點:"); if(point1 == null) { alert("用戶取消"); return; } var dDis=Math.abs((point1.x - point2.x) * (point1.x - point2.x) + (point1.y - point2.y) * (point1.y - point2.y)); alert("兩點距離:" + dDis.toString()); }