Click here!
 

Upload    Contact    Home
 


R E S O U R C E S

HTMLStuff:

 
 
Home
Artist
Designer
Webmaster
Programmer
What's New
* Resources
 

 

 

JavaScript Escape Character

Ever need to print quotation marks in a JavaScript string. That is not too bad, right? All you have to do is use the other set of quotation marks. If you need to use double quotation marks in a string, then you define the string by using single quotations, that is not hard. Now, what if you needed to use both sets of quotation marks in a string? That is a little bit harder. In this case you could split the string into many different parts and then just append the pieces together, but that can get to be too much work, not to mention confusing. It would be easier to take a look at the table bellow and use JavaScript's escape characters.

Character Meaning
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t Tab
\' Single quote or apostrophe (')
\" Double quote (")
\\ Backslash (\)
\XXX XXX is an octal number (between 0 and 377) that represent the Latin-1 character equivalent. For example \251 is the octal code for the copyright symbol.
\xXX XX is a hexadecimal number (between 00 and FF) that represent the Latin-1 character equivalent. For example \xA9 is the hexadecimal code for the copyright symbol.
\uXXXX XXXX is a hexadecimal number (between 00 and FF) that represent the Unicode character equivalent. For example \u00A9 is the hexadecimal code for the copyright symbol.
(Note: Unicode is only supported by JavaScript 1.3)

The string "\tTom said \"Hello to everyone!\"\nSo did Mary." would print:

          Tom said "Hello to everyone!"
    So did Mary.

Head on to:
JavaScript Escape Characters
JavaScript Comparison and Logic Operators
JavaScript Event Listing
Pop-Up Window Attributes



Back to Tutorial Menu
Back to Programmer Main Page
Back To HTML Stuff Main Page

 

  News   Contact   Advertise   CD ROM   Search   Upload   Help   Home

Copyright © 2000 Tucows.Com Inc.
TUCOWS.Com Inc. has no liability for any content or goods on the TUCOWS site or the Internet, except as set forth in the terms and conditions and privacy statement.