Change Title of Javascript Alert [duplicate]
How can i change the title of javascript alert popup ?
You can't, this is determined by the browser, for the user's safety and security. For example you can't make it say "Virus detected" with a message of "Would you like to quarantine it now?"...at least not as an alert()
.
There are plenty of JavaScript Modal Dialogs out there though, that are far more customizable than alert()
.
As others have said, you can't do that either using alert()
or confirm()
.
You can, however, create an external HTML document containing your error message and an OK
button, set its <title>
element to whatever you want, then display it in a modal dialog box using showModalDialog().
Simple: you can't.
You can't. The alert is a simple popup where you only can affect the content text.
If you want to change anything else, you have to use a different way of creating a popup.
you cant do this. Use a custom popup. Something like with the help of jQuery UI or jQuery BOXY.
for jQuery UI http://jqueryui.com/demos/dialog/
for jQuery BOXY http://onehackoranother.com/projects/jquery/boxy/
It's not possible, sorry. If really needed, you could use a jQuery plugin to have a custom alert.
精彩评论