Javascript linebreak

S

Shirenseru

Hello guys, i hope you can help me with this cause it's driving me
crazy!

I got the following statement in JavaScript:

if(currTotal < 27{document.getElementById('isResult').innerHTML =
"Blabla, blablabla, 12345")

it displays the message as:

Blabla, blablabla, 12345

But i would like to break it up into three lines, so it would be
displayed as:

Blabla,
blablabla,
12345

Is there anyone that knows how to fix this? I tried \n , but with no
result..
 
R

Randy Webb

Shirenseru said the following on 5/2/2006 9:07 AM:
Hello guys, i hope you can help me with this cause it's driving me
crazy!

I got the following statement in JavaScript:

if(currTotal < 27{document.getElementById('isResult').innerHTML =
"Blabla, blablabla, 12345")

it displays the message as:

Blabla, blablabla, 12345

But i would like to break it up into three lines, so it would be
displayed as:

Blabla,
blablabla,
12345

Is there anyone that knows how to fix this? I tried \n , but with no
result..

Add a <br> or <p> to it as you are rendering HTML and \n is not a new
line in HTML. \n will add a new line to the source though.

"Blabla,<br> blablabla,<br> 12345<br>"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top