Solved

title of a box (e.g. alert box)

Posted on 2001-08-23
13
323 Views
Last Modified: 2012-08-13
hi,

how can i set the title of a popup box e.g. an alert box.
now, the text "microsoft internet explorer" is displayed.

additionally id'd like to know if i can change the icon being displayed. now a "!" is displayed.


thanks
hreinart
0
Comment
Question by:hreinart
[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
  • 6
  • 4
  • 2
  • +1
13 Comments
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 6418099
You can't.

You can use window.ShowModalDialog to open up a small web page in a dialog window. This will work just like an alert, but you can do most things that you can do in a normal window. A bit tricker to work with, though...
0
 
LVL 2

Accepted Solution

by:
ramses earned 50 total points
ID: 6420051
YES YOU CAN!

All you need to do is write a litle VBSCRIPT routine and then call it from javascript!

And example of this can be found at the following url:

http://www.webreference.com/dhtml/column22/js-vbMsgBox.html

This will show you how to give the users a standard windows msgbox with all icons that you are used to, like the exclamation icon, the queston icon, the information icon and the critical icon, allows you to set the Msgbox Title, and choose what buttons the user can press: Yes, No, Retry, Cancel, Abort, Ignore, as well as set other flags like which button is default and application or system modal msgboxes.

On the same tutorial, you will also learn how to pop up just the InputBox you'll want to use, and plenty of other stuff.

Don't be allarmed because it's VBSCRIPT...  Almost every browser is capable of processing it, and if it doesn't, the script is cross-browser compatible, meaning that if the browser does not support vbscript, it will use the javascript equivalents.  Plain and simple!

Just use the functions provided in the tutorial and your visiters will see a web-page behaving like a real windows-application!


Ramses says Roooar
0
 

Author Comment

by:hreinart
ID: 6420076
hi ramses,

this looks very nice.
if i put the messagebox into my page, i only see the text.

could you give me the source for 1 simple page just displaying this box?


thanks
hreinart
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:ramses
ID: 6421154
I will... hold on


BTW: if you use Netscape it's possible you get the Javascript alertbox

(depends on wich version)


Hold on a few minutes while i look for the source
0
 
LVL 2

Expert Comment

by:ramses
ID: 6421196
Here you go!

Just copy and paste it into a html file, open it in your browser and press the Click Me button.

In MSIE you'll see the enhanced msgboxes and in NS you see the standard msgboxes

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

IE4 = document.all;

function newAlert(title,mess,icon,mods) {
   (IE4) ? makeMsgBox(title,mess,icon,0,0,mods) : alert(mess);
}

function newConfirm(title,mess,icon,defbut,mods) {
   if (IE4) {
      icon = (icon==0) ? 0 : 2;
      defbut = (defbut==0) ? 0 : 1;
      retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
      retVal = (retVal==6);
   }
   else {
      retVal = confirm(mess);
   }
   return retVal;
}

function IEBox(title,mess,icon,buts,defbut,mods) {
   retVal = (IE4) ? makeMsgBox(title,mess,icon,buts,defbut,mods) : null;
   return retVal;
}
function newConfirm(title,mess,icon,defbut,mods) {
   if (IE4) {
      icon = (icon==0) ? 0 : 2;
      defbut = (defbut==0) ? 0 : 1;
      retVal = makeMsgBox(title,mess,icon,4,defbut,mods);
      retVal = (retVal==6);
   }
   else {
      retVal = confirm(mess);
   }
   return retVal;
}

//-->
</SCRIPT>
<SCRIPT LANGUAGE=VBScript TYPE="text/vbscript">
<!--

Function makeMsgBox(title,mess,icon,buts,defbut,mods)
   butVal = buts + (icon*16) + (defbut*256) + (mods*4096)
   makeMsgBox = MsgBox(mess,butVal,title)
End Function

Function makeInputBox(title,pr,def)
   makeInputBox = InputBox(pr,title,def)
End Function

-->
</SCRIPT>
</HEAD>
<BODY>
<BUTTON ONCLICK="newConfirm('Question','Wanna continue?',2,1,0)">Click me</BUTTON>
</BODY>
</HTML>
0
 

Author Comment

by:hreinart
ID: 6421375
i'm using ie5

..will look on your code now...
0
 
LVL 2

Expert Comment

by:ramses
ID: 6421385
ok
0
 

Author Comment

by:hreinart
ID: 6421401
hi,

i see the messagebox.
the title is:

vbscript:question


how can i change this?
..e,g,. "this is my messagebox"
0
 
LVL 2

Expert Comment

by:ramses
ID: 6421425
You can change the "Question", but not the Vbscript:

To change the "Question" caption, just alter the code that gets fired when you click the Click me button

<BUTTON ONCLICK="newConfirm('This is my Msgbox','Wanna continue?',2,1,0)">Click me</BUTTON>

with the functions listed above in your <head> section


If you want to be able to use msgboxes without the VBScript prefix, you'll have to use a custom OCX

I can make this very fast if you will, but then your users will have to accept a security warning.  The advantage is then that it will work cross-browser, i mean both NS and MSIE users will have the msgboxes


Ramses says Rooar!
0
 
LVL 2

Expert Comment

by:ramses
ID: 6421573
Hi there

I've made the ocx for you!

Just look at http://www.vep.be/msgbox/ and you'll see!


Ramses says Roooar!
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6783285
This question remains LOCKED but open, awaiting your decision to update and finalize.
Moondancer
Community Support Moderator @ Experts Exchange
0
 

Author Comment

by:hreinart
ID: 6783418
works fine, sorry for beeing late here !
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6784197
Your responsiveness here is very much appreciated.
Moondancer
Community Support Moderator @ Experts Exchange
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Rotate images for Web Page 11 40
Link Anchor Not working 9 67
Read text on Table 7 48
Put javascript to get dropdown value 3 33
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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

734 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