I have a js widget that introduces some function a1 which calculates several math formulas (let's call them f1, f2, f3, etc). When a user clicks on a Calculate button, the results of f1, f2, f3, etc have to be displayed in corresponding table cells. When I include a single line like this
<td><input name="res" value="Calculate" onclick="a1(document.form.f1.value);" type="button"></td>
not just f1, but all other formulas are calculated and their results are displayed. Which works for me. I am not sure however if it's a proper way of specifying "onclick" and if this would work in all browsers.
My question is: when I need to calculate several values, do I need to list all of them in onclick statement? What would be the best way of writing such code?