编辑:已解决
好吧,我的问题是我需要找到一种方法来不断读取我的浏览器中的光标的x,y坐标,然后退出读取x,y坐标onmouseup这里是我到目前为止
var mouseDown = 0;
var xPos = 0;
var yPos = 0;
document.body.onmousedown = function() {
mouseDown = 1;
}
document.body.onmouseup = function() {
mouseDown = 0;
}
function resize(width, height){
document.getElementById('component1').width=width;
document.getElementBYId('component1').height=height;
}
function setSize(){
while(mouseDown == 1)
{
xPos = event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
yPos = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ?
document.documentElement.scrollTop : document.body.scrollTop);
resize(xPos, yPos);
}
}
有什么建议吗?