Entry
Is this silly - value.split("px")[0] -- returns 45 if 45px is in value. Is there another easier way?
Nov 8th, 2001 00:24
Jean-Bernard Valentaten, Gareth Hay,
Well, if what you want is the numbers, that are in front of some chars,
then you could use parseInt(value). This will return:
- NaN (Not a Number) if value doesn't start with a number
- an integer else
The value is beeing parsed until it hit's a sign that is not a number.
So in your case it would return 45.
If you need a floating point, you can use parseFloat().
HTH
Jean