Styles MenuThe BeelineTips & Tricks MenuJavaScript MenuGrouping

JavaScript

Characters

Special characters are used to cause a string to perform some action when printed.

Syntax

The syntax for special characters is

variable = "text \specialcharacter text"

or

document.write ("text \specialcharacter text")

where variable is the name of a variable that stores the string, text is any text, and specialcharacter is:

b, f, n, r, t, or a quotation mark (?).

Description

The special characters and the role played by each are listed below in Table 1. However, be forewarned that only the \" character appears to work in Windows-based Web browsers.

Table 1: JavaScript Special Characters for String Literals.

Character Meaning
\b Backspace
\f Form feed
\n New line
\r Carriage return
\t tab
\" quotation mark

Example

myQuote = "Stephanie said \"Hello\" as she rode by."
document.write(myQuote)

When executed, the document.write statement puts this on the screen:

Stephanie said "Hello" as she rode by.

Return to JavaScript MenuJavaScript

Click for details.

Click for details.Click for details.

Top of PageTool Bar 1Tool Bar 2Tool Bar 3Tool Bar 4Tool Bar 5Tool Bar 6Tool Bar 7Add RequestChange Request
Styles MenuTool Bar 11Tool Bar 12Tool Bar 13Tool Bar 14Tool Bar 15Tool Bar 16Tool Bar 17KeyholeReport Menu

Home PageMain Text MenuMain Tables MenuMain Frames MenuMain Buttons MenuMain TV MenuMain HiveCD MenuMenu Styles Information


Notice 1

Legal notices - Part 1
Special Notice
Legal notices - Part 2
Notice 2