Here is a stripped, simple code for input of 2 numbers, and getting
their sum.
<HEAD>
<script language="javascript">
function adder() {
a=parseFloat(document.nform.ainp.value);
b=parseFloat(document.nform.binp.value);
document.nform.sinp.value=a+b;
}
</script>
</HEAD>
<BODY>
<form action="" method="post" name="nform" >
a <input name="ainp" type="text" size="9">
b <input name="binp" type="text" size="9">
sum <input name="sinp" type="text" size="9" disabled>
<input type="button" value="Add" onClick="adder()">
</form>
</BODY>
</HTML>
My question is:
If I put the inputs into e.g. a table, the function still works, with
the "document.nform.ainp.value" notation.
<BODY>
<form action="" method="post" name="nform" >
<table>
<tr><td>
a <input name="ainp" type="text" size="9">
b <input name="binp" type="text" size="9">
sum <input name="sinp" type="text" size="9" disabled>
<input type="button" value="Add" onClick="adder()">
</td></tr>
</table>
</form>
</BODY>
I would think that the <table>, <tr> and <td> should have names or id's
interferring into that hierarcical notation?
Regards knos