Calculating multiple variables onclick
I have a js that introduces some function a() that includes math formulas for a number of variables, say v1, v2,v3, etc. When a user enters data in my form and clicks a button, the calculated values of all the variables have to be displayed in appropriate fields of the form. I am using this script:
Note that although it includes only variable v1, I saw that all other variables (v2, v3, etc) are also calculated onclick and displayed in the form. This is good, however, I am not sure if this is the right practice and this script would work in all browsers. I wonder if anyone could suggest the best practice for a form buttom that would calculate and display multiple variables onclick.
<td><input value="Calculate" onclick="a(document.form.v1.value);" type="button"></td>