Javascript new line

Discussion in 'Web Design and Development' started by MacDonaldsd, Mar 7, 2007.

  1. MacDonaldsd macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #1
    I have the following code :

    document.writeln(totalString)

    document.writeln(OrderedString)

    And these print out the correct information to the web page but all on one line, Where and how do I put the code for a newline ?
     
  2. epochblue macrumors 68000

    epochblue

    Joined:
    Aug 12, 2005
    Location:
    Nashville, TN
    #2
    Put this in between the two: document.writeln("<br/>");
    Once you're done with that, I recommend reading up a little on JavaScript at w3schools. It's a very helpful resource.

    http://www.w3schools.com/
     
  3. mnkeybsness macrumors 68030

    mnkeybsness

    Joined:
    Jun 25, 2001
    Location:
    Moneyapolis, Minnesota
    #3
    via zend

    (newline meaning \n)
     
  4. epochblue macrumors 68000

    epochblue

    Joined:
    Aug 12, 2005
    Location:
    Nashville, TN
    #4
    Right, but it does accept HTML strings. And I think it accepts "\n", but it doesn't turn it into anything meaningful (IE - not a <br/>).
     
  5. MacDonaldsd thread starter macrumors 65816

    MacDonaldsd

    Joined:
    Sep 8, 2005
    Location:
    London , UK
    #5
    Thanks for all of your help

    epochblue of using:
    document.writeln("<br/>");

    works 100% fine.

    I was trying with \n and that wouldn't work, it broke the javascript code
     

Share This Page