homepage Welcome to WebmasterWorld Guest from 54.235.29.110
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Anything similar to EOD heredoc definitions in Javascript?
optik




msg:3946963
 2:16 pm on Jul 6, 2009 (gmt 0)

Hi

When defnining a variable in PHP you can avoid using slashes on every quote by using
i=<<<EOD
value
EOD;

is there anything similar in javascript or is escaping quotes the only way?

 

whoisgregg




msg:3948627
 7:36 pm on Jul 8, 2009 (gmt 0)

Not in the code directly, but you could store the data in a hidden input or div and access it's value or .innerHTML (respectively) if you have a really long bit of text/html to write.

There are some hacky ways of doing it with comments, but nothing I've seen is reliable across browsers.

optik




msg:3948741
 10:21 pm on Jul 8, 2009 (gmt 0)

ok I'll probably stick with escaping quotes

DrDoc




msg:3948777
 11:06 pm on Jul 8, 2009 (gmt 0)

Or, singlequote the string itself ... that way you do not have to escape all doublequotes.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved