quotes within quotes

They have: 59 posts

Joined: Mar 2000

In Javascript, what can you do about the fact that Netscape has trouble with quotes inside quotes? What does the character "\" mean? Does that just mean see the following character for what it is rather than interpreting it as part of Javascript? (I hope that question made sense.) - Phyllis

They have: 231 posts

Joined: Feb 2000

You are right. The backslash is used when you want to embed special characters. The character comes after the backslash.

\n = new line
\' = quote
\" = double quote

So if you have a string with a quote in it use this:

var htmlStr = "You said \"Hello\".";

:: Lloyd Hassell :: http://www14.brinkster.com/lloydh ::

They have: 59 posts

Joined: Mar 2000

Thanks! I had put a bunch of those into a long string of text that had quotes in it, but I had begun wondering if I was using them wrong. -Phyllis

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.