469,579 Members | 1,414 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

SUM TEXTFIELD VALUES

Hi,
was just wondering how I can sum values from different textboxes,..
I used "+" but this adds the values together rather then creating a sum of
them.

e.g.

var x = document.clear.field1.value; (e.g. 10)
var y = document.clear.field2.value; (e.g. 11)

var sum = x + y (that comes up with 1011) rather then 21.
How can I add them together so the result is 21 ?
Any ideas.
Thanks
Jul 20 '05 #1
1 5423
Filiz Duman wrote:
Hi,
was just wondering how I can sum values from different textboxes,..
I used "+" but this adds the values together rather then creating a sum of
them.

e.g.

var x = document.clear.field1.value; (e.g. 10)
var y = document.clear.field2.value; (e.g. 11)

var sum = x + y (that comes up with 1011) rather then 21.
How can I add them together so the result is 21 ?
Any ideas.
Thanks


http://www.jibbering.com/faq/#FAQ4_21

var sum = +x + +y;
--
Randy

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Sidney Linkers | last post: by
1 post views Thread by platostoteles | last post: by
4 posts views Thread by Tomislav | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.