Javascript linebreak

Discussion in 'Javascript' started by Shirenseru, May 2, 2006.

  1. Shirenseru

    Shirenseru Guest

    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..
    Shirenseru, May 2, 2006
    #1
    1. Advertising

  2. Shirenseru

    Randy Webb Guest

    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>"

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
    Randy Webb, May 2, 2006
    #2
    1. Advertising

  3. Shirenseru

    Shirenseru Guest

    Oh my god..

    was it that easy.. '-_-

    Thanks a lot man!
    Shirenseru, May 2, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S
    Replies:
    5
    Views:
    9,890
  2. Alexander Ryck

    linebreak in <select>-menu?

    Alexander Ryck, Mar 7, 2004, in forum: HTML
    Replies:
    1
    Views:
    827
    Jukka K. Korpela
    Mar 7, 2004
  3. Tim Johansson

    Remove linebreak before header

    Tim Johansson, Aug 17, 2004, in forum: HTML
    Replies:
    5
    Views:
    976
    Robert Frost-Bridges
    Aug 18, 2004
  4. Alex Funke

    Headline without linebreak

    Alex Funke, Aug 30, 2004, in forum: HTML
    Replies:
    3
    Views:
    506
    WebcastMaker
    Aug 30, 2004
  5. Jonas Galvez
    Replies:
    0
    Views:
    269
    Jonas Galvez
    Feb 20, 2004
Loading...

Share This Page