Here's something that I recently did:
<script language="Javascript">
function AddMe()
{
 var total;
 total = 0;
 num1 = parseInt(form1.number1.value);
 if (isNaN(num1) == 0) {
  total = total + num1;
 }
 num2 = parseInt(form1.number2.value);
 if (isNaN(num2) == 0) {
  total = total + num2;
 }
 num3 = parseInt(form1.number3.value);
 if (isNaN(num3) == 0) {
  total = total + num3;
 }

 form1.total.value = total;
}
</script>

<form name="form1" method="post">
Number 1 <input type="text" name="number1" onblur="javascript:AddMe()"><br>
Number 2 <input type="text" name="number2" onblur="javascript:AddMe()"><br>
Number 3 <input type="text" name="number3" onblur="javascript:AddMe()"><br>
Your total : <input type="text" name="total">

</form>
----- Original Message -----
From: "Jerry Staple" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, July 13, 2001 4:10 AM
Subject: Javascript Function


Hi,
 Could anyone inform me of any javascript function that takes the total
of numbers entered into a textbox and displays them in another? eg
<form name="form1">
Item a = 2 (number in text box)
Item b = 3
Item c = 4
Total = 9 (this total is generated by adding the items in the textboxes
above)
</form>

Any help will much apreciated


Jerry Staple
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to