Try this code below, I tried it and it seemed to work fine, just for your interest the .value bit should be a lower case v.
<title>hello</title>
<script type="text/javascript">
<!--
function showAnswer(FormField)
{
document.AnswerMe.myOutput
}
function showAnswer2()
{
document.AnswerMe.myOutput
}
//-->
</script>
<pre><h1>Calculator</h1></
<form name="AnswerMe">
Enter first number <input type="text" size="10" value="1" name="myInput">
Enter second number <input type="text" size="10" value="2" name="myInput2">
<input type="button" value="+" onclick="showAnswer(myInpu
<input type="button" value="-" onclick="showAnswer2(myInp
Thrice your number is <input type="text" size="10" value="Answer goes here" name="myOutput1">
Thrice your number is <input type="text" size="10" value="Answer goes here" name="myOutput2">
</form>
Main Topics
Browse All Topics





by: webwomanPosted on 2004-02-16 at 12:40:10ID: 10375587
Try
1.value = eval(document.AnswerMe.myI nput.Value ) + eval(document.AnswerMe.myI nput2.Valu e)
<input type="button" value="+ " onclick="showAnswer()">
<input type="button" value=" - " onclick="showAnswer2()">
And also, try this...
document.AnswerMe.myOutput
Othewise you're probably adding two strings and then taking the value -- 2+3=23