...

View Full Version : converting or adding two strings as numbers?



SuperRoach
08-27-2007, 07:55 AM
is surely a simple question.... and comes down to this... can i add two strings which are supposed to be numbers together?

x = 5+6

= 11

x = "5" + "6"

= 56

the reason I ask is because I have two values inside input boxes on a form (html), and when I try to add the two values together, it appends then as if they are strings!

i can post the code if needed, although if you can fix the "5" + "6" above to return 11, that would fix it too

liorean
08-27-2007, 10:38 AM
There's many ways. See 378573.

SuperRoach
08-28-2007, 03:55 AM
Thanks. I have used the Numbers() method in the end, very handy.
Can I then refer to a dynamic location? for example:

currentLetter = a // The current increment
form.testbox[currentLetter].value = 'Im in the right place!'
// form being the form called, and end result should be form.testboxa.value = '...'



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum