Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Elapsed time

Status
Not open for further replies.

bjorna

Programmer
May 28, 2001
12
NO
Hi

How can i determine the time elapsed between to mouse clicks?
What I want is the javaScript to display a warning message if the user clicks the same graphic button more than one time within e.g. 30 seconds.

Grateful for any answere.

rgds BjornA
 
Off the top of my head ..

- While the page is loading set clickFlag=False
- Write a function to call when the user clicks the image;
Code:
function imgClick
// if the user has already clicked the image, the flag is set and we'll show the warning
if clickFlag
then
  message "Can't click this yet"
else
// flag isn't set so set it and schedule the reset function for 30 seconds
  clickFlag=True
  setTimeOut("resetClick",30 seconds)


function resetClick()
  clickFlag=False
Sorry if this is a bit vague but the principle is there. It'll be good practice translating my scribble into proper syntax anyway :)

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top