Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quotation marks

Status
Not open for further replies.

jay25

MIS
Jun 17, 2002
16
US
If I am using document.write() to write some HTML code, tags and all, how do I nest quotes more than two deep?
Thanks.
 
", \", \\\", \\\\\\\", \\\\\\\\\\\\\\\", \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" ... etc.

The thing is, you need to escape the backslash and escape the quote. The formula is:

Where n is the amount of quote nesting, the number of total characters (backslashes + quote) is 2^n. So, if there is no quote nesting, use 1 character (quote by itself). If it is nested once, use 2 characters (backslash and quote).
This can really add up! Use combinations of double and single quotes wherever possible.
bluebrain.gif
blueuniment.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top