12.9. Special (Escaped) String Characters
JavaScript provides a mechanism for including common whitespace characters (sometimes called control codes) inside strings, as well as symbols that otherwise conflict with string representation. The key is the backslash character (\), followed immediately by a single character with a special meaning. The following table shows the recognized escaped characters and their meanings.
These characters come in handy for alert, confirm, and prompt dialog box text. For example, if you want to display multiple paragraphs with a blank line between them in an alert box, you would insert line feed characters: alert("First paragraph.\n\nSecond paragraph.") Note that these characters apply to strings, and do not influence HTML content formatting for carriage returns. Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|