views:

157

answers:

2

EDIT: Solved

Ok, my problem is that I need to find a way to constantly read x,y coordinates of the cursor in my browser onmousedown and then to quit reading the x,y coordinates onmouseup here is what I have so far


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);
    }

}

any suggestions?

+1  A: 

Have a look at http://javascript.internet.com/page-details/mouse-coordinates.html for a working example

Matt
I can't get this to work when mousedown event occurs. How would you do it?
AFK
got it working.
AFK
A: 

Coordinates of the cursor see here

http://java.pakcarid.com/Cpp.aspx?sub=386&ff=3063&topid=40&sls=25

lois