Two Laptop Bag*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Adding two variables in java script." Watch "Adding two variables in java script." New topic
Author

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
author
Rancher

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

Eric
 
Consider Paul's rocket mass heater.
 
subject: Adding two variables in java script.
 
Similar Threads
unable to access the values of dynamically newly added rows to table
sending a Collection from JSP to Servlet
printing index of an collection in JSP using JSTL
Help - Table generated by javascript and reset by history.go(-1)
Space not releasing on toggle of divs