473,239 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,239 software developers and data experts.

how close modal dialog from the first window

Hi,
I use JavaScript
I have tree windows.
Jonan1.html has this code erref1=window.open("Jonan2.html", "mypage",null);
This opens Jonan2.html and it has this code
erref=window.showModalDialog("Dialogo.html", null);
This opens Dialogo.html

How can I do to close Jonan2.html and Dialogo.html from Jonan1.html
How can I get the Dialogo.html reference from Jonan1.html.

regards

Jonan
Jul 20 '05 #1
3 20577
jo********@yahoo.es (Jonan) writes:
I have tree windows.
Jonan1.html has this code erref1=window.open("Jonan2.html", "mypage",null);
This opens Jonan2.html and it has this code
erref=window.showModalDialog("Dialogo.html", null);
Is "erref" a global variable?
This opens Dialogo.html

How can I do to close Jonan2.html and Dialogo.html from Jonan1.html
How can I get the Dialogo.html reference from Jonan1.html.


You have a reference to the window that Jonan2.html is in (erref1). If
"erref" is a global variable of Jonan2.html, you can close it from
Jonan1.html as:
erref1.erref.close();
Then you can close Jonan2.html
erref1.close();

<URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_12>
<URL:http://www.infimum.dk/HTML/JSwindows.html#ref_2_5>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
"Jonan" <jo********@yahoo.es> wrote :
Hi,
I use JavaScript
I have tree windows.
Jonan1.html has this code erref1=window.open("Jonan2.html", "mypage",null); This opens Jonan2.html and it has this code
erref=window.showModalDialog("Dialogo.html", null); This opens Dialogo.html

How can I do to close Jonan2.html and Dialogo.html from Jonan1.html
How can I get the Dialogo.html reference from Jonan1.html.

To do this, you can:
1) Pass johan2.html window reference to dialogo.html in arguments
2) In dialog script store dialog window reference to opening window
variable.
3) In jonan1.html close dialog window first, then close jonan2.html

Here's sample:
--------------johan1.html -----------------
<script>
var erref1=null;
function openIt() {
erref1=window.open("johan2.html", "mypage",null);
}
function closeIt() {
if (erref1 && !erref1.closed) {
if (erref1.dlgwin) erref1.dlgwin.close();
erref1.close();
}}
</script>
....
<button onclick=openIt() >Open johan2</button>
<button onclick=closeIt()>Close johan2</button>
....

--------------johan2.html -----------------
<script>
var dlgwin=null;
function openDlg() {
var retValue=showModalDialog("dialogo.html",{opener:wi ndow});
dlgwin=null;
}
</script>
...
<button onclick=openDlg()>Open Dialog</button>

--------------dialogo.html -----------------
<script>
dialogArguments.opener.dlgwin=window;
</script>
-----------------------------------------------

HTH
Jul 20 '05 #3
"Alexander Ignatyev" <al***@b52tech.com> wrote in message news:<bj***********@gavrilo.mtu.ru>...
"Jonan" <jo********@yahoo.es> wrote :
Hi,
I use JavaScript
I have tree windows.
Jonan1.html has this code erref1=window.open("Jonan2.html",

"mypage",null);
This opens Jonan2.html and it has this code
erref=window.showModalDialog("Dialogo.html",

null);
This opens Dialogo.html

How can I do to close Jonan2.html and Dialogo.html from Jonan1.html
How can I get the Dialogo.html reference from Jonan1.html.

To do this, you can:
1) Pass johan2.html window reference to dialogo.html in arguments
2) In dialog script store dialog window reference to opening window
variable.
3) In jonan1.html close dialog window first, then close jonan2.html

Here's sample:
--------------johan1.html -----------------
<script>
var erref1=null;
function openIt() {
erref1=window.open("johan2.html", "mypage",null);
}
function closeIt() {
if (erref1 && !erref1.closed) {
if (erref1.dlgwin) erref1.dlgwin.close();
erref1.close();
}}
</script>
...
<button onclick=openIt() >Open johan2</button>
<button onclick=closeIt()>Close johan2</button>
...

--------------johan2.html -----------------
<script>
var dlgwin=null;
function openDlg() {
var retValue=showModalDialog("dialogo.html",{opener:wi ndow});
dlgwin=null;
}
</script>
..
<button onclick=openDlg()>Open Dialog</button>

--------------dialogo.html -----------------
<script>
dialogArguments.opener.dlgwin=window;
</script>
-----------------------------------------------

HTH

Hello Alexander,

thank you very much

Jonan
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Patrick Lim | last post by:
Here is the problem: I have written a non-modal frame class in Java for displaying help text when a user is using an application. It works as desired in that if the user selects "help" again,...
2
by: Simon Storr | last post by:
Is it possible to make the parent window refresh when a modal dialog is closed? I know I can use window.opener.location.reload(true); for a 'normal' window, but this doesn't work for...
8
by: william | last post by:
Hi All, I have a question about closing a dialog box. The thing is: I have two ASP.NET pages. From one page, I open another page as window.showModalDialog. THere is a button on the second page. On...
2
by: anil kumar via .NET 247 | last post by:
(Type your message here) hi, i am using save & cancel webform button my webpage to with somevalidations , when i am trying to save my content it is savedthat time i need a popup msg like ur 'data...
4
by: Hitesh | last post by:
Hi, I am opening an Modal dialog box using the window.Showmodaldialogbox(), and in that window i am having an aspx form with say one ASP.NET Button control. i am doing some operation on the...
22
by: stephen | last post by:
I have created an order form that users javascript to create a new html document when the customers clicks the "print page" button. Once the new document has been created it then prints the...
2
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the...
2
by: =?Utf-8?B?TGVuaTIwMDA=?= | last post by:
Hi, I would like to write a c# application. to detect if a modal dialog opens on another application, (e.g. notepad.exe save changes dialog when you click exit ) and auto cancel it. How do I detect...
11
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.