![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
相关问题
<script language="javascript">
var MOVEOBJ = null;
var MOVEFLAG = false;
var CURRENTX = CURRENTY = 0;
function moveIt(obj){
document.onmousemove = move;
document.onmouseup = drop;
MOVEOBJ = obj;
CURRENTX = (event.clientX + document.body.scrollLeft);
CURRENTY = (event.clientY + document.body.scrollTop);
return true;
}
function move(){
if (MOVEOBJ == null) { return false; }
MOVEFLAG = true;
newX = (event.clientX + document.body.scrollLeft);
newY = (event.clientY + document.body.scrollTop);
// newX = event.x;
//newY = event.y;
distanceX = parseInt(newX - CURRENTX);
distanceY = parseInt(newY - CURRENTY);
var arr = new Array();
// alert(MOVEOBJ.Points.value);
arr = MOVEOBJ.Points.value.split(",");
arr_newX = parseInt(arr[2]) + distanceX ;
arr_newY = parseInt(arr[3]) + distanceY ;
MOVEOBJ.Points.value = arr[0] + ',' + arr[1] + ',' + arr_newX + 'pt,' + arr_newY + 'pt,' + arr[4] + ',' + arr[5];
CURRENTX = newX;
CURRENTY = newY;
event.returnValue = false;
return false;
}
function drop(){
alert(MOVEOBJ.Points.value);
if(MOVEFLAG) MOVEFLAG = false;
MOVEOBJ = null;
return true;
}
</script>
onmousedown='moveIt(this);' style="position:absolute"/>
提问者:leec1981 08-17 11:11
答复

