Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2005
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to Insert the Degree Symbol

    I need to insert the degree symbol into my output. I know that in html, the symbol is ° or °. How do I include the html in javascript? Everything that I try returns an error.

  • #2
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In Firefox, you can insert a degree symbol as follows:

    Code:
    document.body.appendChild(document.createTextNode("\u00B0"));
    "00B0" is the hexadecimal value of the degree symbol's index in the Unicode character set.

    You can append it to output like so:

    Code:
    myOutput += "\u00B0";
    You may need to modify it for other browsers, but it's a start. Hope this helps.

  • #3
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    here's an online unicode convertor:
    http://www.hot-tips.co.uk/useful/unicode_converter.HTML

    When trying to insert a special character in a javascript string, you must always use its unicode escape value

    \uXXXX , where XXXX is the hexa digits value of the ASCII
    Last edited by Kor; 01-11-2006 at 12:03 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •