Solved

Simulating a ModalDialog window in VBScript

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

762 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

21 Experts available now in Live!

Get 1:1 Help Now