0
What's wrong in the code
6 Answers
+ 5
You should have the signs in the middle of one and two, then have a submit or "equal" button to put in the functions together
0
thanks
0
thanks
0
but I didn't understand your answer
0
if don't mind please write the code
- 1
Your add function should look like this:
function add() {
var form =document.getElementById("frmclac");
var n1 = form.elements.namedItem("txtn1").value;
var n2 = form.elements.namedItem("txtn2").value;
form.elements.namedItem("txtnans").value = eval(n1)+eval(n2);
}
It can't be nested in your calc function as it currently is.
Your form tag shouldn't have a name attribute. It requires an id="frmclac" instead.