Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alert function
Message
From
12/03/2003 07:30:15
 
General information
Forum:
Internet
Category:
Javascript
Title:
Miscellaneous
Thread ID:
00764480
Message ID:
00764689
Views:
34
>Hi everybody,
>
>I'm using alert function in JavaScript. Is there a way to customize it? E.g. I don't like the title "MS Internet Explorer" and would prefer my own. How do you solve this problem?
>
>Thanks in advance.

There is no way to change the title on the alert box (same applies to the prompt & confirm boxes) - see remarks here.
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/alert.asp

If you are writing code specifically for IE, then you might be able to use the showModalDialog method.
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp

This may require an additional HTML document, or you could use the following trick my son showed me the other day to directly display HTML from the address bar, by prefixing with "about:" rather than "http:".
function myalert( AlertTxt, AlertTitle )
{
var DspHtml="about:<head><title>"+AlertTitle+"</title></head>"
DspHtml=DspHtml+"<body><center>"+AlertText+"<br><button onclick='window.close()'>OK</button></center></body>"
showModalDialog( DspHtml, "", "dialogWidth:200px;dialogHeight:50px;status:0;help:0;resizable:no;scroll:no" )
}
Unfortunately, it appears that you cannot get rid of the "blue chrome" title bar & it does put extra text after your own title, but you could pad the title with non-break spaces to move that off the title bar. You would also have to put extra code in to get the correct width & height for messages.
Len Speed
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform