Title of a JavaScript Alert Box

How do you chang the title of a javascript alert box?

scottymac
samacdonaldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

maneshrCommented:
you cannot change a title of a javascript alert box. i think that this is due to security reasons. otherwise anyone can mimic system message boxes and get inputs from the user!!

0
sthungCommented:
This is no way to change the javascript alert, prompt, confirm dialog box title because of the implementation of netsacpe and Internet Explorer is different. And the javascript standard doesn't provide that feature.
0
HolySpiritCommented:
samacdonald,
U can try this VBScript to change the title of the alert box since JavaScript cannot do this :

<HTML>
<script language = VBScript>
Sub alert(title, content)
      MsgBox content, 0, title
End Sub
</script>
<body>
      <input type = button value = "Click me" onClick = "alert 'Here is the title', 'Here is the content'">
</body>
</HTML>

<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>
Can this script solve your problem?
<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>

-- Holy Spirit
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

knightEknightCommented:
That might work in IE only.
The other option is just to define your own alert:

<SCRIPT langauge='javascript'>
function myalert(title,msg)
{
   var mypopup = window.open("",title,width=300,height=200);
   mypopup.document.open();
   mypopup.document.writeln("<HTML><BODY><FORM><CENTER>");
   mypopup.document.writeln(msg);
   mypopup.document.writeln("<INPUT type='button' value='OK' onClick='self.close();'>");
   mypopup.document.writeln("</center></form></body></html>");
   mypopup.document.close();
}

....

<input type="button" value="Click Me" onClick="myalert('Here is the title', 'Here is the content');">
0
knightEknightCommented:
typo on my first line up there... should be:

  var mypopup = window.open("",title,"width=300,height=200");
0
knightEknightCommented:
Come to think of it, I forgot the title part altogether!

<SCRIPT langauge='javascript'>
function myalert(title,msg)
{
   var mypopup = window.open("",title,"width=300,height=200");
   mypopup.document.open();
   mypopup.document.writeln("<HTML><HEAD><TITLE>"+title+"</title></head>");
   mypopup.document.writeln("<BODY><FORM><CENTER>");
   mypopup.document.writeln(msg);
   mypopup.document.writeln("<INPUT type='button' value='OK' onClick='self.close();'>");
   mypopup.document.writeln("</center></form></body></html>");
   mypopup.document.close();
}
</script>
....
<input type="button" value="Click Me" onClick="myalert('Here is the title', 'Here is the content');">
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.