I am trying to make a calculator with Javascript, and I’m having a few problems…
The code is at http://jsfiddle.net/NwkQW/10/.
- Try adding some values, and you’ll see that the box that says TOTAL will change according to the values you enter. However, you’ll also see that if you click CLEAR FORM, the value will not go back to TOTAL. How do I do that?
- I want to link to the javascript (e.g.
<script type="text/javascript" src="mydomain.com/calculate.js></script>), but if I try, it doesn’t work right! HELP!!!
Thanks!
add a onClick to your clear form button like:
reset won’t clear anything that’s not a form element
see http://jsfiddle.net/NwkQW/16/