|
-
Oct 24th, 2003, 06:05 PM
#1
Thread Starter
Fanatic Member
operators/prompt
hi there,
using prompt I would like to ask the visitors to write any of the"operators"(+,*,- or /)
and let my script give the correct answer:
----------------
youselected=prompt('write an oprerator','you choose')
aa=Math.floor(Math.random()*10)
bb=Math.floor(Math.random()*10)
cc=(aa..(any operators that my visitors selected.."youselected")......bb)
could you please help me with this "javascript problem?"
thanks
Last edited by merhaba; Oct 24th, 2003 at 06:09 PM.
-
Oct 25th, 2003, 03:15 PM
#2
var a, b, c;
var op = prompt("Operator?", "You choose");
a = Math.floor(Math.random() * 10);
b = Math.floor(Math.random() * 10);
eval("c = a " + op + " b;");
alert(c.toString());
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
|