|
-
Jan 18th, 2004, 10:38 PM
#1
Thread Starter
Addicted Member
simple operator question
I wanna allow user to enter 2 values then i add them up togther
<script type="text/javascript">
var x = prompt("Please enter a value for x","")
var y = prompt("Please enter a value for y"," ")
if (x != null && x != "" && y != null && y != "")
{
var result
eval ("result = x" + "y")
document.write("Your result is " + result)
}
</script>
eg: i key 1 for x and 2 for y the result i get is 12 instead of 3
pls help

Akababy.Net... Life Redefined!
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
|