Java Script new line

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Dec 2006
Posts: 17
Reputation: pojke is an unknown quantity at this point 
Solved Threads: 0
pojke pojke is offline Offline
Newbie Poster

Java Script new line

 
0
  #1
Feb 5th, 2007
Hi.
Perhaps a lot of you heart this problem, but i can't find a solution.
Java Script is crashing when see \n sign.
I have a lot of functions like this:
  1. function drawDocumentMainRowColor1(unique, content, align, padding, color) {
  2. drawDocumentHTML += '<tr class="stdTab" bgcolor="#' + color + '"><td>&nbsp;</td><td style="padding: ' + padding + 'px 10px;" colspan="2" align="' + align + '">' + content + '</td></tr>';
  3. }

..where content is any string. Now if in string appear \n or \r sign page is dead. (JS error)

T U for any help
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 29
Reputation: bhuvan83 is an unknown quantity at this point 
Solved Threads: 0
bhuvan83's Avatar
bhuvan83 bhuvan83 is offline Offline
Light Poster

Re: Java Script new line

 
0
  #2
Mar 13th, 2007
instead of \n use document.write("<br />"
c if it works
Bhuvan Aggarwal
There is no word impossible.
its i m possible
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 17
Reputation: pojke is an unknown quantity at this point 
Solved Threads: 0
pojke pojke is offline Offline
Newbie Poster

Re: Java Script new line

 
0
  #3
Mar 13th, 2007
It wont work so easy, cause content is from form. Its user, who write a content, so i cant request writing <br> instead \n.
But its ok, ive solved it in another way.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: farkhan is an unknown quantity at this point 
Solved Threads: 0
farkhan farkhan is offline Offline
Newbie Poster

to pojke...

 
0
  #4
32 Days Ago
how did you solved the problem ???
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC