Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











Operator: \ (backslash inline or escaped characters)


escape(string)
 
The \ (backslash) is used to insert apostrophes, carriage returns, quotes, tabs, and other special characters inside a string.
 
For example, in JavaScript, the start and stop of a string is delimited with either single or double quotes. However, if the string contains single and/or double quotes, you have problems.
 
Consider the string, "My favorite rose is the "Peach Delight.""
 
JavasScript will chop the output to, My favorite rose is the
 
Fortunately, this has a very simple solution. All you have to do is to place a backslash \ before each double quote in "Peach Delight". This turns each \" into a string literal.
 
The string is becomes, "My favorite rose is the \"Peach Delight\"."
 
JavasScript will now output, My favorite rose is the "Peach Delight."
 
This same concept is used with a variety of other characters. These backslash pairs are refered to as inline or escaped characters.
 
Code:
\' single quote
\" double quote
\\ backslash
\b backspace
\f form feed
\n new line
\r carriage return
\t tab

 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information