[Javascript] How do I convert "FF" to 255?

TomMallard mallard at serv.net
Thu Aug 9 09:47:17 CDT 2001


All you need to do is prefix "0x" to the hex number and then use parseInt()
or parseFloat().

alert(parseInt(0xFF))

tom mallard
seattle
----- Original Message -----
From: "a d a g i l s o n @" <adagilson at yahoo.com>
To: <javascript at LaTech.edu>
Sent: Saturday, April 21, 2001 2:27 PM
Subject: Re: [Javascript] How do I convert "FF" to 255?


> Try this:
> The JavaScript Source: Equivalents: Hex-RGB Converter
> I don't know if it's exactly what you want but...
> a.
> Peter Brunone wrote:
>        Unfortunately, upon closer examination, I see that this doesn't do
jack.
>     ----- Original Message -----
>     From: Peter Brunone
>     To: javascript at LaTech.edu
>     Sent: Friday, April 20, 2001 12:10 PM
>     Subject: Re: [Javascript] How do I convert "FF" to 255?
>           According to the Netscape JavaScript reference, you can use
escape(var) to get the hexadecimal value, and unescape(var) to get the
decimal value.
>       ----- Original Message -----
>       From: Rui Fortes
>       To: javascript at LaTech.edu
>       Sent: Friday, April 20, 2001 11:23 AM
>       Subject: [Javascript] How do I convert "FF" to 255?
>        Hello. How can I get an highlighted version of a color.That is, how
can I find the code of a color wich is a lighter version of another color.I
tryed to do this myself but I need, for instance, to know how to get a
number from a string representing an hexadecimal number.I could then add
some value to RGB components and use RGB(newred, newgreen, newblue) to get
that color.I found Hex function that returns a string representing the
hexadecimal convertion of a number.Is there an inverse function to turn a
string into a number?Something like afunc("FF") that returns 255. Thanks
>
>
>




More information about the Javascript mailing list