Why doesn't this javascript/html calculator program not work?

Falken

New member
Here's the code. It should be pretty straight forward. I'm super confused. I don't get at all what's wrong with it/why it's not working. Help is greatly appreciated :)

<HTML>


<HEAD>


<TITLE> Lab no. 3 Cole Stevens </TITLE>


<script language="Javascript">


function calculate(form)


{


var answer = eval(form.valueA.value);


form.valueB.value= answer;


}





function clearbox(form)


{


form.valueA.value="";


form.valueB.value="";


}



</SCRIPT>



<BODY>


<FORM NAME="math">


<P> Mathematical expression: <INPUT TYPE="text" NAME="valueA" SIZE="20">


<P> Answer: <INPUT TYPE="text" NAME="valueB" SIZE="20">


<P> <INPUT TYPE="button" VALUE="Calculate!" NAME="calculate" onClick="calculate(this.form)">


<P> <INPUT TYPE="button" VALUE="Clear" NAME="clear" onClick="clearbox(this.form)">



</BODY>
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
function calc(form)
{
var answer = eval(form.valueA.value);
form.valueB.value = answer;
}

<P> <INPUT TYPE="button" VALUE="Calculate!!" NAME="calculate" onClick="calc(this.form)">

Just changed the function name calculate to calc and it worked
Calculte might be a keyword or someting i guess but not sure
 
Back
Top