- Code: Select all
<SCRIPT language=JavaScript>
function perc1() {
a = document.form1.a.value/100;
b = a*document.form1.b.value;
document.form1.total1.value = b
}
function perc2() {
a = document.form1.c.value;
b = document.form1.d.value;
c = a/b;
d = c*100;
document.form1.total2.value = d
}
</SCRIPT>
- Code: Select all
<div><span style="font-size: 24px; font-weight: bold; text-decoration: underline;"><br />
</span>
<form name="form1">
<table cellspacing="1" cellpadding="1" border="0">
<tbody>
<tr>
<td>Exchanges under $100 =
<input type="hidden" size="5" value="25" name="a" />25% of
<input size="5" name="b" />? </td>
<td>Answer:
<input maxlength="40" size="5" name="total1" disabled="disabled" /></td>
<td>
<input onclick="perc1()" type="button" value="Calculate" /></td>
</tr>
</tbody>
</table>
</form></div>
This basically works out 25% of the input, now how I do make a new tr tag that will auto substract the input(b) - the percentage answer (total1)


