PDA

View Full Version : Display newline text


peh1696
10-10-2004, 05:48 AM
I have a problem on newline function....

this is my code:
HTML code,
<p id="lblProductInfo"></p><p id="lblProduct"></p>

JavaScript code,
document.getElementById('lblProductInfo').innerHTML = strProdInfo
document.getElementById('lblProduct').innerHTML ="Grand total: \n"+intTotalPrice+"\n\n---------------------------------------\n"

When display,

Products VirusProtector Professional Quantities:1 GST: 27.27 Total: Aus 300 ---------------------------------------

Grand total: 327.27 ---------------------------------------

the "\n" (newline) function cant works....wat should i do?

TQ

Max

¥åßßå
10-10-2004, 06:06 AM
document.getElementById('lblProduct').innerHTML ="Grand total: <br />"+intTotalPrice+"<br />
<br />---------------------------------------<br />"

senshi
10-10-2004, 06:29 PM
depends on where your putting the output????

<textarea> requires a \r\n combo, the \r is carrige return and moves the cursor to the beginning of the line, the \n forces a newline and the cursor is moved to the next line down.

in a HTML page, the <br> is used in place of the \r\n combo.

¥åßßå
10-10-2004, 06:37 PM
<p id="lblProduct"></p>