Solved

Simulating a ModalDialog window in VBScript

Posted on 1998-10-13
4
1,604 Views
Last Modified: 2013-12-25
Is there anyway I can simulate a Modal Dialog window in VBScript with a window.open?  I don't want to use the
window.showModalDialog command because there are features in the standard window that I need that is not supported by the showModalDialog window.

Basically I want my window to simulate the action that the window does not lose focus until it is closed.

Any ideas?
0
Comment
Question by:Mira060397
  • 3
4 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 100 total points
ID: 1855667
try JavaScript:
<SCRIPT LANGUAGE="JavaScript">
modalres = '';
WinId = window.open('mymodal.htm','newwin','width=300,height=100');
if (!WinId.opener) WinId.opener = self;
</SCRIPT>

and in the mymodal.htm have
<BODY onBlur="if (window.focus) self.focus()">
<H3>Click one</H3>
<FORM>
<INPUT TYPE="BUTTON" VALUE="OK" onClick="opener.modalres='ok';self.close()">
<INPUT TYPE="BUTTON" VALUE="CANCEL" onClick="opener.modalres='cancel';self.close()">
</FORM>

0
 

Author Comment

by:Mira060397
ID: 1855668
Okay I tried that, but the only problem is that I can't click or
select anything in the myModal.htm.  It seems that it keeps giving the focus to the <BODY> and anytime I click some element with in the <BODY> it causes the <BODY> to lose focus, so it resets the focus, etc.  I'm testing this in IE4, so I don't know if this is suppose to work in Netscape.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1855669
What do you have in the body?
Any input fields or buttons in the mymodal.htm should be inside the <BODY></BODY> tags so if the body has focus the user shoudl be able to interact. I will have a look in IE4.

In the meantime, you can shift the focussing to the body tag in the opening page instead <BODY onFocus="if (WinId && window.focus) WinId.focus()">

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1855670
You are correct! What a crock!

It works in NS 3 and 4 so we need to find a workaround somehow...

I will investigate tomorrow

Michel
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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

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

10 Experts available now in Live!

Get 1:1 Help Now