Click to See Complete Forum and Search --> : Instantly add text box values
danprhayes
03-12-2003, 04:00 AM
I have 3 rows of text boxes.
First row = user defined integer
Second row = different user defined integer
thrid row = the total of each column added together.
How is this possible? Simple surely?
Without a button (so it adds as data typed).
thanks
gil davis
03-12-2003, 06:16 AM
<form onsubmit="return false">
<input type="text" name="i1" onkeyup="this.form.sum.value=Number(this.value)+Number(this.form.i2.value)"><br>
<input type="text" name="i2" onkeyup="this.form.sum.value=Number(this.value)+Number(this.form.i1.value)"><br>
<input type="text" name="sum" onfocus="this.form.i1.focus()">
</form>
Dan Drillich
03-12-2003, 07:55 AM
You might consider flipping onkeyup with onchange. So, the sum is changed only when the user finishes the number entry.
danprhayes
03-12-2003, 08:30 AM
Thats brilliant.... many thanks.... despite doom and gloom and possibility of a war there will always be helpful and friendly people like you lot to answer our questions...
Have a happy life and be good..