![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Display Number (Amount) Properly Kind of new at this so I do not know all of the correct script keywords. How do you display an amount as currency properly when the number is 5.6 I have Response.Write "$" & Amount & " is what you owe the school district" Sorry, I would like for it to display as $5.60. It currrently display as $5.6 I have not done enough scripting to learn how to do this. Naturally when the amount does not end in 0 it works. Thank You in Advance Grandma Leona |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Display Number (Amount) Properly On Aug 22, 7:54 am, Leona Leal Educator <LeonaLealEduca...@xxxxxx> wrote: Quote: > Kind of new at this so I do not know all of the correct script keywords. > > How do you display an amount as currency properly when the number is 5.6 > > I have Response.Write "$" & Amount & " is what you owe the school district" > > Sorry, I would like for it to display as $5.60. It currrently display as > $5.6 I have not done enough scripting to learn how to do this. Naturally > when the amount does not end in 0 it works. > > Thank You in Advance > > Grandma Leona Response.Write "$" & formatnumber(Amount, 2, true, true, true) _ & " is what you owe the school district" Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Display Number (Amount) Properly In microsoft.public.scripting.vbscript message <45B8F8CD-884A-4129-8D22- 47AC06AC518D@xxxxxx>, Fri, 22 Aug 2008 04:54:01, Leona Leal Educator <LeonaLealEducator@xxxxxx> posted: Quote: >Kind of new at this so I do not know all of the correct script keywords. > >How do you display an amount as currency properly when the number is 5.6 > >I have Response.Write "$" & Amount & " is what you owe the school district" > >Sorry, I would like for it to display as $5.60. It currrently display as >$5.6 I have not done enough scripting to learn how to do this. Naturally >when the amount does not end in 0 it works. then results may not be accurate, because such numbers cannot be stored exactly as IEEE Doubles. Try document.write 0.01 + 0.06 - 0.07 for example. Commonly, display rounding will give the right value; but it may be unwise to rely on that. You don't want something that usually works. Do your calculations in integer pence, and if you use no fractional pence all will be exact. Convert the result X to String - CStr(X) -, add leading zeroes if needed to make the length at least three, insert a decimal point, and display. -- (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3 6.20 ; WinXP. Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links. PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm> My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Display does not align text properly | Vista General | |||
| Some desktop icons won't display properly | Vista General | |||
| Re: number of recent programs to display - How to clear? | Vista General | |||
| Re: number of recent programs to display - How to clear? | Vista General | |||