Forum Moderators: open

Message Too Old, No Replies

How to format an alert box message

         

danlott

10:50 am on Aug 11, 2003 (gmt 0)

10+ Year Member



hi guys,
i've just written a code which validates a form. I have an alert message saying something like "You need to fill in a valid email". I've just learnt you can use tags like "\n" in the alert code to move the text to another line. Are there any other tags I could use? could i format the text, make it bold?
cheers
- D

coopster

3:42 pm on Aug 11, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can use Escape Sequences:
  • \b = Backspace
  • \f = Form feed
  • \n = New line
  • \r = Carriage return
  • \t = tab
  • \' = Apostrophe or single quote
  • \" = Double quote
  • \\ = Backslash
  • \000 = octal character
  • \x00 = hexidecimal character
  • \u0000 = hexidecimal unicode character

You can get the character from the ascii/iso/uni character code sets. For example, alert('\u00A9') will show the copyright symbol.

But, I don't believe you can format text (such as bold) in an alert function; if you can, I don't know how.

AWildman

4:35 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



If you really need to format, you might consider using a pop-up over an alert box.

danlott

12:14 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



cheers guys, thats just what i wanted to know. pity you cant format the text, but that may be a blessing in disguise.
- D