?
Solved

Giving title for JavaScript Alert message

Posted on 2004-09-14
6
Medium Priority
?
358 Views
Last Modified: 2010-05-18
Hi All...
           Can anyone help me on this issue. I m working on JavaScript and in case of JavaScript alert messages its title is shown as "Microsoft Internet Explorer" as I m using IE5 as my browser. I want to give my own title in the alert meassage. Is it possible?? If yes then write me how. Waiting for your reply..

Shamakant Sharma.
Sr. Programmer
Path Infotech Ltd.

0
Comment
Question by:shamakant_sharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 12053125
You can't.
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12053130
//iE soln only, use vbscript
<HTML>
<script language = VBScript>
Sub alert(title, content)
     MsgBox content, 0, title
End Sub
</script>
<body>
     <input type = button value = "Click " onClick = "alert 'My title', 'Hello World'">
</body>
</HTML>
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12053156
0
 
LVL 33

Accepted Solution

by:
sajuks earned 500 total points
ID: 12053165
//create your own ( credit to mplungjan )
<html>
<head>
<title></title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"><!-- //
function fakeAlert(cMsg,cTitle,cImg) {
alertOptions="screenX=500,screenY=400,top=400,left=500,height=100,width=200,hotkeys=no"

newWin=window.open("","fakeAlertWindow",alertOptions)
newDoc=newWin.document
newDoc.write('<ht'+'ml><he'+'ad><tit'+'le>'+cTitle+'</tit'+'le></he'+'ad><bo'+'dy bgColor="silver" onLoad="document.forms[0].elements[0].focus()">');
newDoc.write('<table><tr><td><img src="'+cImg+'" width=34 height=34 alt="" border=0></td>');
newDoc.write('<td><font size="-1">'+cMsg+'</font></td></tr>');
newDoc.write('<tr><td colspan=2 align="Center">');
newDoc.write('<form><input type="button" value="OK" onClick="window.close();"></form>');
newDoc.write('</td></tr></table></bo'+'dy></ht'+'ml>');
}
//-->
</script>
</head>
<body>
Fake alert box.
<form name="frmMain">
<input type="button" value="Click Me" onClick="fakeAlert('This is a fake alert box.','Alert title','icon2tr.gif')">
</form>
</body>
</html>
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question