473,406 Members | 2,707 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,406 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 20586
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.