Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    Member dinologic's Avatar
    Join Date
    Jan 2003
    Posts
    54
    Member #
    539
    not used often...can't remember. How do you insert a "line feed" or "carriage return" in javascript? For instance...
    Code:
    alert("This is the first line." + ??? + "This is the second line.");
    Thx.

  2.  

  3. #2
    JR
    JR is offline
    Senior Member JR's Avatar
    Join Date
    Nov 2002
    Location
    UK
    Posts
    4,354
    Member #
    257
    are you are talking about the equivalent of <br>?

    if so i think it is \n
    JR

  4. #3
    Member dinologic's Avatar
    Join Date
    Jan 2003
    Posts
    54
    Member #
    539
    hmm...that looks familiar, but I'm getting "invalid character". I tried \p also because I could swear there was a 'p' involved. Damn...I know I used it somewhere else a while back but I can't seem to find it.

  5. #4
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    You would need to code it as follows:
    Code:
    alert("This is the first line.\nThis is the second line.");
    Syntactically, the "\n" should appear inside quotes since it is an escape character.
    - Brian

  6. #5
    Member dinologic's Avatar
    Join Date
    Jan 2003
    Posts
    54
    Member #
    539
    ah HA! Rock on, skrlin.

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    you can also use "\t" to insert a tab

  8. #7
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Or you can just order one from your keyboard like Homer does.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  9. #8
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    You can do what I did and play around with the different combinations of "\" and a letter for example:

    \n = new line
    \t = tab
    \r = carraige return (same as \n)

    I think there are more, but try it out and see what you get.
    - Brian

  10. #9
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    http://www.webreference.com/js/tips/991005.html

    C++ also has \a which makes the computer beep
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  11. #10
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    /u /y and /z do something too, I'm just not sire what.
    - Brian


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

javascript carriage return line feed

,

javascript line feed

,
javascript line feed carriage return
,

javascript linefeed

,
javascript new line carriage return
,
jquery carriage return line feed
,
js line feed
,

line feed in javascript

,

line feed javascript

,
linefeed javascript
Click on a term to search for related topics.
All times are GMT -6. The time now is 10:16 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com