Select your language
My slogs
search & comment
 
Slog about how to make round input boxes
Share slog:
Comments
*Please enter your name
how to make round input boxes by
*Please enter your comment

*Please enter your email
*Please enter a valid email
Notify me on replies to 
how to make round input boxes by You
Now
how to make round input boxes by richarduie
The content (value) returned by prompt() is of the String type. You're using parseInt() on the value, and it's working exactly correctly, i.e., it's reading numeral String up to the first non-numeral character and converting it to an Integer. What you should be using for decimal input Strings is parseFloat() NOT parseInt().

For fractions of the form {m/n},recognize that the {/} is an operator (a non-numeral character), and parse*() functions aren't appropriate. You need to evaluate the expression, using the eval() function.
June 29, 2009 | 2:49 am | Report abuse | Reply
how to make round input boxes by P.S.P.
I have several questions on avoiding JavaScript rounded calculations on information (integers/numbers) from prompt boxes, and then with entering fractions in prompt boxes where prompt boxes always ignores the denominator of fractions that's put in. (i.e. if I put in 2/5 in a prompt box then convert it to integer, javascript will count that as 2, which is nowhere near 2/5!)

So, I'm still working around making some calculators with JavaScript, I got the basics down to make these calculators work efficiently. On one of my calculators, it is the slope calculators:

For example, if I want to calculate the slope of a line, my calculator would give me decimals as the result, it's ok, but if I want to just get the regular fractions returned instead of decimals how can I do that with JavaScript?

Also, using the prompt box to collect information from user, then converting that information to integers using parse.Int(), it always automatically rounded fraction to the nearest ones, which I don't want either.

For example, if I put in 2.4 in a prompt box, it will return as 2, which is bad for full calculation, how can I make prompt boxes return integer information as what it is without rounding it?

Then, even worse if I put in fractions in prompt box, it always ignores then denominator of it. For example, if I have a fraction of 10/0 JavaScript thinks of it as just 10, when it should be undefined! Same with regular denominator, if I put in 10/2 Javascript will still think of it as 10.

All of these is user input using the prompt boxes, which later I convert to integers with parse.Int()

Help would be greatly appreciated for fixing all of these problems that I don't want. Thanks!
June 28, 2009 | 9:22 pm | Report abuse | Reply


Tagged as
Add-ons , Hunting , MySpace , TVs

Slogs related to how to make round input boxes

Popular slogs
Results
Semantic refine:  Add-ons - Hunting - MySpace - TVs
Neowin Forums > Best way to create rounded corners on inp...
www.slogbox.com
copy
A cool article which tells you about rounded coreners which will work in all the browsers including ie6!...http://htmlcsstutorials.blogspot.com/2009/06/niffy-ro...
www.slogbox.com
copy
dvd decrypter/dvd shrink
www.slogbox.com
copy
Searching...

Español   |   English   |   Português   |   Русский   |   Contact us
All opinions expressed here belong to the authors and do not necessarily reflect the opinions of Slogbox.com

Wait
Add your comment
Thank you for helping us improve the quality of this site.
*Please enter your name
how to make round input boxes by
*Please enter your email
*Please enter a valid email
Notify me on replies to 
Reply

*Please enter your name
how to make round input boxes by
*Please enter your comment
*Please enter your email
*Please enter a valid email
Notify me on replies to