954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Java Script new line

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:

function drawDocumentMainRowColor1(unique, content, align, padding, color) {
    drawDocumentHTML += '<tr class="stdTab" bgcolor="#' + color + '"><td>&nbsp;</td><td style="padding: ' + padding + 'px 10px;" colspan="2" align="' + align + '">' + content + '</td></tr>';
}


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

T U for any help

pojke
Newbie Poster
17 posts since Dec 2006
Reputation Points: 10
Solved Threads: 0
 

instead of \n use document.write("
"
c if it works

bhuvan83
Light Poster
29 posts since Mar 2007
Reputation Points: 10
Solved Threads: 0
 

It wont work so easy, cause content is from form. Its user, who write a content, so i cant request writing
instead \n.
But its ok, ive solved it in another way.

pojke
Newbie Poster
17 posts since Dec 2006
Reputation Points: 10
Solved Threads: 0
 

how did you solved the problem ???

farkhan
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You