|
-
Mar 18th, 2003, 02:49 PM
#1
Thread Starter
Fanatic Member
text box
hi,
Let the computer create a number between 1 and 10 randomly
and let me try to guess it..(whitout using PROMPT) HOW can I enter a number?how can I use an text field(input-box) to submit my number?..(javascript)
then I will write..
if(mynumber==computernumber)
document.bgColor="blue"...
can anyone help me...?
thanks
-
Mar 19th, 2003, 06:11 AM
#2
Frenzied Member
Code:
<form action="#" onsubmit="if(this.txt1.value == computernumber) document.bgColor="blue"; return false;"><p>
<input name="txt1" />
<input type="submit" />
</p></form>
You could call a function instead of having the code directory in the onsubmit event handler if you want. Do you need the random number code as well?
-
Mar 19th, 2003, 09:40 AM
#3
Thread Starter
Fanatic Member
random numbers..
hi,
yes I think i need thaat too.
I would write..
aaa=Math.floor(Math.random()*10)+1..
will this do?
and let's see what u suggest??.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|