faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 2 people (0%) answered Yes
Recently 0 of 2 people (0%) answered Yes

Entry

How can I put formatted, multi-line text in a variable?

Apr 8th, 2008 18:43
ha mo, Dave Clark, Phil Bruce,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Phil,
     If you mean a hard-coded string literal, the following is an 
example of that:
var str = 'Now is the time for all young men to come \n'+
          'to the aid of their country.  The quick \n'+
          'brown fox jumped over the lazy dog.\n';
     The following is another example of that:
var str = '';
str += 'Now is the time for all young men to come \n';
str += 'to the aid of their country.  The quick \n';
str += 'brown fox jumped over the lazy dog.\n';
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com