Forum Moderators: open

Message Too Old, No Replies

Large chunks of html in a javascript var

How is it done?

         

PSWorx

9:57 pm on May 2, 2006 (gmt 0)

10+ Year Member



Any help with being able to post multiline chunks of html data into a javascript var?

TIA

Trace

4:41 pm on May 3, 2006 (gmt 0)

10+ Year Member



There's no difference between putting a little HTML into a js variable or a lot. Just remember to escape the special characters.

someVar = '<font color=\"red\">Something</font>';

or

someVar = '<font color=\"red\">';
someVar = someVar + 'Something</font>';

PSWorx

7:38 pm on May 3, 2006 (gmt 0)

10+ Year Member



Sorry i needed to use multi line HTML content within a javascript variable however found that everytime i used a new line for the content of the var it broke the js script, ive found a solution now but thanks for the help

vistaworx