We can use special characters ('\n') to add line breaks in text in
JavaScript popup Alert boxes.
True.
there is also few additional special characters:
\' single quote
\" double quote
Those are not special characters in any way. They are escape sequences
required only when the escaped character already serves as a string literal
delimiter.
Well, the same goes for \a, \c, \d and so on in string literals, because it
is not a valid escape sequence. The ampersand does not need to be escaped.
Again, that is not a special character, but an escape sequence for the
backslash character, which serves as escape sequence prefix itself
(hence the requirement to escape it if the literal character is needed).
\n new line
\r carriage return
\t tab
\b backspace
\f form feed
That is true, and the characters displayed by those escape
sequences are the only special characters you mentioned.
ECMAScript Edition 3 also defines the escape sequence
\v (equivalent to \u000B)
Is there also additional characters for more reach formatting? (bold
text, etc)?
No.
Need we put "\n" inside quotations?
I do not know if you have to; I have, as I prefer to have running code.
\n is an escape sequence valid within (string and RegExp) literals only.
Is there some Javascript popup Alert box text formatter, to format text
from GUI, more handy way?
No. You will have to create your own popup window. There are some
proprietary approaches, such as showModalDialog() in the IE DOM, that
support you in creating modal windows as you know them from window.alert():
<URL:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp>
Gecko-based UAs have window.open(..., ..., "modal") and window.openDialog():
<URL:
http://developer.mozilla.org/en/docs/DOM:window#Methods>
But none of these is interoperable.
And to save you another Frequently Asked Question (FAQ[1]): it is
utter nonsense to try to simulate that behavior with window.open()
by programmatically trying to force the focus on the popup window,
because that is very likely to make the rest of the GUI unusable.
PointedEars
___________
[1] <URL:
http://jibbering.com/faq/>