SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Hybrid View
-
Oct 15, 2007, 14:23 #1
- Join Date
- Mar 2004
- Posts
- 639
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Does JavaScript have <<<TEXT analog?
Hello guys,
I'm using PHP's <<<TEXT TEXT; a lot and I'd like to use something similar with JS. Is it possible? Does JS have <<<TEXT analog?
-
Oct 15, 2007, 18:07 #2
What does it do?
-
Oct 16, 2007, 01:09 #3
- Join Date
- Mar 2004
- Posts
- 639
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Using it you can put ANY text or HTML into variable without converting " to \" etc.
For example:
PHP Code:$variable = <<<TEXT
any kind of text or "html" or something else
you can use a lot of rows
...
TEXT;
HTML Code:$variable = "any kind of text or \"html\" or something else" + "you can use a lot of rows" + "...";
-
Oct 16, 2007, 01:43 #4
Unfortunately, you have to manually escape quotes in JavaScript.
-
Oct 16, 2007, 01:55 #5
- Join Date
- Mar 2004
- Posts
- 639
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Oct 16, 2007, 05:02 #6
- Join Date
- Apr 2004
- Location
- germany
- Posts
- 4,324
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
In javascript you can use backslash to continue string literal on the next line
Code:a = "row1 \ row2 \ row3"
Bookmarks