Solved

Simulating a ModalDialog window in VBScript

Posted on 1998-10-13
4
1,658 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
[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
  • 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

Industry Leaders: 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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to count occurrences of each item in an array.

705 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