• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Javascript onmousedown event to Execute Continuosly

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I had a time field of minutes in input Text followed by an Image top image(greater then symbol) when i fire onmousedown event i need to call a function recursefunction() multiple times with some timeout and when i release the mouse i.e onmouseup recurcisvefunction() must be Stopped and also clear the Timeout.

My Html Code


My JavaScript Code looks like :





but onmousedown simply called only once similar to onclick i found no difference, Suggest me a Solution so that i can move in right path.



Regards,
Srikanth



 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use setInterval on mousedown
use clearInterval on mouseup

 
look! it's a bird! it's a plane! It's .... a teeny tiny ad
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic