Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 13th, 2006, 04:09 PM
Authorized User
Join Date: Nov 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default calculating grand total

I'm doing a school project and I'm trying to add up several text boxes, however some of them are blank and when I calculate them I get a NaN result. Here is my code:

qty1= parseFloat(document.form1.qty_prt.value)
qty2= parseFloat(document.form1.qty_mon.value)
qty3= parseFloat(document.form1.qty_comp.value)
alert("quantity is " + qty_tot)

Old December 18th, 2006, 06:19 AM
Friend of Wrox
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919

Hii blkskullwork!!

You need to check whether the text box is empty or having not a valid number
.Possible solution is use validtion that no text boxes have empty /invalid number.
then Add those text boxes value

Hope this will help you

Cheers :)

Old December 18th, 2006, 10:36 AM
Authorized User
Join Date: Nov 2006
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks for your reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
PIVOT TABLE Grand Total ... pls help !!!! laky Access VBA 0 June 2nd, 2006 03:47 AM
PIVOT TABLE Grand Total ... pls help !!!! laky Access 0 June 2nd, 2006 02:15 AM
Calculating total form! require assistance Neeko Java Basics 1 May 4th, 2006 06:48 AM
Grand Total mateenmohd Access 6 April 8th, 2005 07:30 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.