Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-26-2002, 03:39 AM   PM User | #1
Blinded4freedom
New Coder

 
Join Date: Jul 2002
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Blinded4freedom is an unknown quantity at this point
need help with this java script!!

ok i need to develpe a javascript that generates a randome number, then asks you to guess a number, that also gives you hints. ex to high or too low.

any help is greatly appreciated
Blinded4freedom is offline   Reply With Quote
Old 07-26-2002, 05:08 AM   PM User | #2
joh6nn
wei wu wei


 
joh6nn's Avatar
 
Join Date: Jun 2002
Location: 72° W. 48' 57" , 41° N. 32' 04"
Posts: 1,887
Thanks: 0
Thanked 1 Time in 1 Post
joh6nn is an unknown quantity at this point
that sounds suspiciously like a homework assignment
__________________
bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

i am a loser geek, crazy with an evil streak,
yes i do believe there is a violent thing inside of me.
joh6nn is offline   Reply With Quote
Old 07-26-2002, 05:12 AM   PM User | #3
x_goose_x
Regular Coder

 
Join Date: Jun 2002
Location: Montreal, Canada
Posts: 644
Thanks: 0
Thanked 0 Times in 0 Posts
x_goose_x is an unknown quantity at this point
<script>
range = 100;
num = Math.round(Math.random()*range);
function guess(g) {
document.guessform.lastguess.value = g;
document.guessform.guesses.value = parseInt(document.guessform.guesses.value)+1;
if (g>num) {
document.guessform.hint.value = "Lower";
}else if (g<num) {
document.guessform.hint.value = "Higher";
}else{
document.guessform.hint.value = "Correct";
}
}
</script>

<form name="guessform" onSubmit="guess(this.myguess.value); return false;">
Guess: <input type="text" name="myguess"><br>
Hint: <input type="text" name="hint"><br>
Last Guess: <input type="text" name="lastguess"><br>
Guesses: <input type="text" name="guesses" value="0"><br>
<input type="submit" value="Guess">
</form>
x_goose_x is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:40 PM.


Advertisement
Log in to turn off these ads.