Previous Example-|-Next Chapter's Examples-|-Return to Chapter Listing
Example 4.7:
Special Characters in String Literals
We've created four variables:
twainA: This has quotation marks indicated like this--> \" and \'
twainB: This has the quotation marks, and we've entered a new line immediately before the word because, like this--> \n
twainC: This is the same as twainB, except that instead of using \n we used <BR>
twainD: This is the same as twainB, except that instead of using \n we used \t to place a Tab character.
The following shows what happens when you use the document.write instruction:
The following buttons show what happens when you place these strings into Alert boxes:
This is the script we used. First we declared these variables in the HEAD:
Then we wrote the variables to the Web page, like this:
Then we created four buttons:
Previous Example-|-Next Chapter's Examples-|-Return to Chapter Listing