[thelist] Javascript and breaking within strings

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Mon Apr 18 16:29:04 CDT 2005


   You could also do it this way:

theVar = "Line 1 text" +
"Line 2 text" +
"Line 3";

...although it's not likely you'd want it since the method Jay illustrated is less complex.

 From: "Jay Blanchard" 

[snip]
Can you make a multiline block of text a string variable, without 
breaking it up?

WHAT I WOULD LIKE TO DO (gives me a "unterminated string literal"
error):
theVar = "Line 1 text

Line 2 text

Line 3
";

WHAT I AM FORCED TO DO:
theVar = "Line 1 text
";
theVar += "Line 2 text
";
theVar += "Line 3 text
";

Thanks so much for any clarification.
[/snip]

You can use a backslash IIRC

theVar = "Line 1 text
\
Line 2 text
\
Line 3
";


More information about the thelist mailing list