1st Dec 2017, 2:58 AM
Mike
Mike - avatar
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
1st Dec 2017, 3:02 AM
Matthew Johnson
Matthew Johnson - avatar
0
thanks
1st Dec 2017, 3:08 AM
Mike
Mike - avatar
0
thanks
1st Dec 2017, 3:08 AM
Mike
Mike - avatar
0
but I didn't understand your answer
1st Dec 2017, 3:08 AM
Mike
Mike - avatar
0
if don't mind please write the code
1st Dec 2017, 3:08 AM
Mike
Mike - avatar
- 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.
1st Dec 2017, 4:05 AM
John Wells
John Wells - avatar