Solved

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

Posted on 2001-08-23
13
312 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
  • 6
  • 4
  • 2
  • +1
13 Comments
 
LVL 29

Expert Comment

by:Göran Andersson
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 2

Expert Comment

by:ramses
Comment Utility
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
Comment Utility
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
Comment Utility
i'm using ie5

..will look on your code now...
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Expert Comment

by:ramses
Comment Utility
ok
0
 

Author Comment

by:hreinart
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
This question remains LOCKED but open, awaiting your decision to update and finalize.
Moondancer
Community Support Moderator @ Experts Exchange
0
 

Author Comment

by:hreinart
Comment Utility
works fine, sorry for beeing late here !
0
 
LVL 1

Expert Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now