I have some code that works each time onmouseclick and continuously onmousemove when I set them accordingly. I am looking for a way to combine the two (i.e. like a click and
You could try something like this:
var div = document.getElementById('ex');
div.onmousedown = function(){
document.onmousemove = function(e){
div.innerText = '('+e.pageX +', '+e.pageY+')';
}
document.onmouseup = function(e){
div.innerText = 'Click Me!';
document.onmousemove = function(){};
}
}
It binds the documents mousemove and mouseup event on the divs mousedown.
http://jsfiddle.net/Paulpro/cSKq2/