This is a sample
Pop-Up Window!<\/b><\/center>
Click Here To Close<\/a> <\/body><\/html>'); pwin.name('sampleWin'); pwin.width(400); pwin.height(300); pwin.left('center'); pwin.top('center'); pwin.resizable(); //-->

Handsome • Devilishly Witty • Rakish Good Looks • Compassionate • Caring • Definitely Weird • Totally Wonderful


CWW Calendar

JS OOP

Photos

Jims Videos

Poetry

Quotes

Humour

Thoughts 2 Live By

My Lists

Salsa!

Cookbook

Reiki

Home




Travel Pics @
Photobucket


Videos @
YouTube.Com






Yahoo!Messenger:
james_melanson


E-Mail Me:
Yahoo! E-Mail








Officers of Avalon



moon phases
 


JSNumbers (A Formatting Library)

Whenever I work on a JavaScript program, I always run into problem working with numbers. Either assessing the value, performing math or manipulating the look/format of the number. Quite often, I found myself re-creating the same code time and time again because life is rarely so simply as 2 + 2.

While JavaScript has a lot of internal math functions through the Math() object, there are still things we need to do in the real world that it doesn't cover. That is what this library is for.

This library is for manipulating numbers in a way that is not commonly seen other ways. The only duplicate method you will find is integer() and that's only because of chiding I received for not putting it in the first time. Happy Dave? As well, a couple of these CAN be done with existing methods but my version is a lot easier to remember.

This library was developed for the purpose of formatting number values, not performing math functions per se.

Supported Browsers: Opera 6+, Firefox 1.5+, Netscape 7.0, IE 5.5+ (Possibly some builds of IE5.0)


Here is a sample page:
  1. JSNumbers Example Page

Summary of methods:

isInt()
Returns "true" if the value is an integer, "false" if not.

isDecimal()
Returns "true" if the value is a floating point number, "false" if not.

isNumber()
Returns true if the value is a number, false if there are any alphabetic characters of the native type is an object.
AnyBrowser.Org   Scripts.com


Scripts.com
RATE ME!


Download jsnumbers_v1_02.zip here


Read the users guide, check out the samples
then email any questions here.


integer()
Returns the passed value as an integer (converts 2.6 to 2)

dollar()
Formats the value to two decimal places.

decimal()
Returns the value to the specified number of decimal places.

clean()
Takes any value alpha-numeric combination and converts it to a number. Also removes spaces at the start or end of the value.


Xnth()
Returns only the decimal portion of a floating point number. Rounds the number up if necessary.

padding()
Pads to the right of the decimal point to give a minimum number of characters.

paddingLeft()
Pads to the left of the number value with the specified character.

addCommas()
Formats the number with commas in front of every third character counted from the right end.



Esse Quam Videri

Proud To Be Canadian!

© 2001, Me
Hosted by www.Geocities.ws

1