SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot themissingelf's Avatar
    Join Date
    Nov 2001
    Location
    UK
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Please remind me how to create line breaks in Javascript alert boxes...

    I have a simple alert box that appears 'onLoad' to display a warning message for a form.

    At the moment all the text in the alert box is unformatted; appearing as one paragraph.

    I seem to recall that it is possible to insert line breaks or new paragraphs; however, cannot remember the code.

    Can you help?

  2. #2
    Anyone seen my cypher? OneChance's Avatar
    Join Date
    Apr 2001
    Location
    Seattle
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    \n

    ??? Maybe.

  3. #3
    I have an opinion...
    Join Date
    Sep 2001
    Location
    Barrie, Ontario
    Posts
    324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    \n = newline
    \t = tab

    alert( '\tThis an indented line, which continues\non the next line.' );
    Egotist: A person more interested in himself than in me.
    KodeKrash - Eidix - Barrie LUG

  4. #4
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    If interested, see the "Alert Tricks" script/tutorial at my site


    Hi KodeKrash

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still

  5. #5
    SitePoint Guru DenverDave's Avatar
    Join Date
    Feb 2001
    Location
    Denver, Colorado
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If we place quite a bit of text in the alt paramenter of an image tag, is there any way to create line breaks or effect the display of the popup text?

  6. #6
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just insert &# 13; (without the space of course) into your alt text whenever you want a line break
    "There's no justice like angry mob justice!" --Seymour Skinner

  7. #7
    SitePoint Guru DenverDave's Avatar
    Join Date
    Feb 2001
    Location
    Denver, Colorado
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll be darned it works! How did you now that??? I know the ASCII characters.... any other interesting formating tricks?

    I've been experimenting with a PHP product called WebCalendar which has JavaScript popup windows for event descriptions. There is some very browser specific and complicated code to generate the pop window and questionable location. I could not help but notice that the alt parameter on an image seems to handle the positioning issues for all browsers. I've never seen someone try to put a paragraph of information in here, but it does seem to work.

    Thank you Thank you Thank you Thank you Thank you !!!!!

  8. #8
    pg for mild peril cow's Avatar
    Join Date
    Mar 2000
    Location
    nevada, usa
    Posts
    636
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    check out this page, it has some other helpful decimal equivalents:

    click here
    "There's no justice like angry mob justice!" --Seymour Skinner


Bookmarks

Posting Permissions

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