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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need simple "guess the number"

Status
Not open for further replies.

vistor

Technical User
Dec 22, 2000
164
US
I want to set the var to a specific number, 7
I want a form "guess a number between 1 and 10
with an input box for the user to put their number in.
I need a timeout that so the user can hit a button within 5 seconds to continue the game.
 
You have the algorithm right there basically, all you need to do is package it.
Just write a function to get the value of the text field, then compare it to the current variable - if they are the same, continue - if not give an alert message or something.

I guess onChange in the text field yu want to set a variable which indicates the person has started typing - since you don't want them to be penalised for being slow to find the right number (or do you?).
Then set the timeout to check this variable after 5 seconds and alert them if they have not complied. -BB "Alright whatever man, I'll hook up the hair, but I aint touchin the ring...Cause I'm still a pla--yer"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top