![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.javascript archiveRe: Simple totalling of a column with onChange()
From: Randy Webb <HikksNotAtHome@aol.com>
Date: Sat Apr 29 2006 - 20:56:23 CEST
charliefortune said the following on 4/29/2006 2:20 PM:
var val = +document.forms[0].elements['amount'+x].value;
> document.forms[0].totAmount.value = val;
Don't pass the integer, pass a reference to the field itself using the
Do a test:
Fill out the form, go back and change the first input to a new number,
> 1. Is there a way to avoid having to pass the 'x' index. Surely the DOM
It doesn't matter in this case, you need to re-total all the fields
> 2. The parseFloat doesn't seem to work, is my syntax correct ?
No.
Try this:
function getTotal(){
It depends on any field being calculated starting with the string "amount".
-- Randy comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ Coded intentionally without ; ending statementsReceived on Mon May 1 05:27:00 2006 |