OZONE Asylum
Forums
Multimedia/Animation
Variables from input text
This page's ID:
11223
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Okay. Quick consult w/ the almighty Moock. Data derived from user input text fields is always of the [b]string[/b] data type. There are several ways to deal with this. One I showed you: Number(x) converts x from a string to a numeric value. parseInt(x) also converts x to a number with the advantage of dropping any non-numeric info, so if some wise acre put in "6 miles per hour", parseInt() would ignore anything not a number. It will also discard any decimals, so parseInt("10.8 mph") would return 10. parseFloat() would keep a floating point number: parseFloat("10.95 US Dollars") would return 10.95 - obviously useful if the input was currency, but also useful for keeping any decimal data. You got it straight now?
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »