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

Peter Brunone peter at brunone.com
Mon Apr 23 10:14:34 CDT 2001


Rui,

    We're glad you got the problem worked out... but everybody gets the messages you send to the list, so you only need to send them once (and we all saw Tom's message already, since it was also sent to the list).

Cheers,

Peter
  ----- Original Message ----- 
  From: Rui Fortes 
  To: javascript at LaTech.edu 
  Sent: Sunday, April 22, 2001 11:13 AM
  Subject: Re: [Javascript] How do I convert "FF" to 255?


  TomMallard proposed an even better way:

  This works...

  parseInt('0xFF')

  The 0x means it's a hex number.

  tom----- Original Message ----- 
    From: Filipiak, Bob (Contractor) 
    To: 'javascript at LaTech.edu' 
    Sent: Friday, April 20, 2001 7:19 PM
    Subject: RE: [Javascript] How do I convert "FF" to 255?


    Modify this:

    <<HTML>
    <<HEAD>
    <<TITLE>Numbers Conversion Table</TITLE>
    <</HEAD>

    <<BODY>
    <<B>Using toString() to convert to other number bases:</B>
    <TABLE border=1>
    <<TR>
    <<TH>Decimal</TH>
    <<TH>Hexadecimal</TH>
    <<TH>Binary</TH>
    <</TR>
    <<SCRIPT language="JavaScript">
    <<!--
    var content = "";
    var i = 0;
    for (i = 0; i <= 255; i++){
        content = "<TR>";
        content = content + "<TD>" + i.toString(10) + "</TD>";
        content = content + "<TD>" + i.toString(16) + "</TD>";
        content = content + "<TD>" + i.toString(2) + "</TD></TR>";
    document.write(content)
    }

    //-->
    <</SCRIPT>
    <<TR><TD>&nbsp;</TD><TD>&nbsp;</TD><TD>&nbsp;</TD></TR>
    <</TABLE>
    <</BODY>
    <</HTML>


    Bob Filipiak (Contractor)
    MCP 

      -----Original Message-----
      From: Rui Fortes [mailto:RuiFortes at clix.pt]
      Sent: Friday, April 20, 2001 12:23 PM
      To: javascript at LaTech.edu
      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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010423/545ccda4/attachment.htm>


More information about the Javascript mailing list