phpknight Posted August 3, 2009 Share Posted August 3, 2009 If I am using mousemove, how do I test during the move whether the mousebutton is down or up? Quote Link to comment https://forums.phpfreaks.com/topic/168568-solved-testing-for-mousedown/ Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 var mouseDown = FALSE; document.body.onmousedown = function() { mouseDown = TRUE; } document.body.onmouseup = function() { mouseDown = FALSE; } That will set mouseDown to TRUE if it's down, or FALSE if up. Quote Link to comment https://forums.phpfreaks.com/topic/168568-solved-testing-for-mousedown/#findComment-889404 Share on other sites More sharing options...
Mardoxx Posted August 3, 2009 Share Posted August 3, 2009 don't you need to add an event handler first? Quote Link to comment https://forums.phpfreaks.com/topic/168568-solved-testing-for-mousedown/#findComment-889521 Share on other sites More sharing options...
haku Posted August 3, 2009 Share Posted August 3, 2009 He added two - document.body.onmousedown and document.body.onmouseup. Although it may be worth setting them to run on pageload. Quote Link to comment https://forums.phpfreaks.com/topic/168568-solved-testing-for-mousedown/#findComment-889524 Share on other sites More sharing options...
Mardoxx Posted August 3, 2009 Share Posted August 3, 2009 I meant like captureEvents() or addEventListener() Quote Link to comment https://forums.phpfreaks.com/topic/168568-solved-testing-for-mousedown/#findComment-889549 Share on other sites More sharing options...
haku Posted August 3, 2009 Share Posted August 3, 2009 No, those aren't necessary. Quote Link to comment https://forums.phpfreaks.com/topic/168568-solved-testing-for-mousedown/#findComment-889552 Share on other sites More sharing options...
phpknight Posted August 3, 2009 Author Share Posted August 3, 2009 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/168568-solved-testing-for-mousedown/#findComment-889784 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.