jQuery in Action, 2nd edition*
The moose likes HTML, CSS and JavaScript and the fly likes Adding two variables in java script. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Adding two variables in java script." Watch "Adding two variables in java script." New topic

Adding two variables in java script.

Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
When I try to add two values from a hidden variables, it gets concatinated.
Can any one tell me how can i add it ?

[ December 23, 2005: Message edited by: Srinivasa Raghavan ]

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
They are strings, so you need to parseFloat() or parseInt() to convert them before adding.

I agree. Here's the link: http://aspose.com/file-tools
subject: Adding two variables in java script.
Similar Threads
Space not releasing on toggle of divs
printing index of an collection in JSP using JSTL
unable to access the values of dynamically newly added rows to table
sending a Collection from JSP to Servlet
Help - Table generated by javascript and reset by history.go(-1)