>>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.
Hi Len,
That seems like what I wanted and intented to write myself. Should I add a copyright? :)
BTW, found a code (from tek-tips) to "hide" the source of the page: (but looks like it works in IE only)
if(window.Event)
document.captureEvents(Event.MOUSEUP);function nocontextmenu()
{event.cancelBubble=true
event.returnValue=false;return false;}function norightclick(e)
{if(window.Event)
{if(e.which==2||e.which==3)
return false;}else
if(event.button==2||event.button==3)
{event.cancelBubble=true
event.returnValue=false;return false;}}document.oncontextmenu=nocontextmenu;document.onmousedown=norightclick;
If it's not broken, fix it until it is.
My Blog