Solved

Giving title for JavaScript Alert message

Posted on 2004-09-14
6
338 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
  • 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 125 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

943 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

Need Help in Real-Time?

Connect with top rated Experts

1 Experts available now in Live!

Get 1:1 Help Now