473,406 Members | 2,378 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.

Close a popup window

I have a popup window appear when a user clicks on a hyperlink in a
datalist. I do it like this:

dr[8] = "javascript:mywindow=window.open(" +
"\"GameStats.aspx?Date="+dr[0] + "&Away="+dr[1] + "&Home="+dr[4] + "\"" +
",\"GamesStats\",\"toolbar=no,location=no,director ies=no,menubar=no,resizabl
e=yes,scrollbars=yes,width=640,height=300\");mywin dow.focus();";

dr[8] is a DataRow item that is added to a DataTable that becomes the
DataSource of the DataGrid.

Is there a way to have that window close when the form that caused it to
appear closes?
Nov 18 '05 #1
2 1570
Using the onunload event of the window object.

window.onunload = ClosePop;
function ClosePop() {
if (mywindow != null) {
if (mywindow != "undefined") {
mywindow.close();
}
}
}

Also, before popping up your window, call ClosePop(). This will assure
that you only have one popup open... assuming you always call your
popup mywindow.
On Sun, 15 Feb 2004 16:03:53 GMT, "David W. Simmonds"
<da***@simmonds.ca> wrote:
I have a popup window appear when a user clicks on a hyperlink in a
datalist. I do it like this:

dr[8] = "javascript:mywindow=window.open(" +
"\"GameStats.aspx?Date="+dr[0] + "&Away="+dr[1] + "&Home="+dr[4] + "\"" +
",\"GamesStats\",\"toolbar=no,location=no,directo ries=no,menubar=no,resizabl
e=yes,scrollbars=yes,width=640,height=300\");mywi ndow.focus();";

dr[8] is a DataRow item that is added to a DataTable that becomes the
DataSource of the DataGrid.

Is there a way to have that window close when the form that caused it to
appear closes?


Nov 18 '05 #2
That works great! Thanks.

"Dan Brussee" <db******@nc.rr.com> wrote in message
news:37********************************@4ax.com...
Using the onunload event of the window object.

window.onunload = ClosePop;
function ClosePop() {
if (mywindow != null) {
if (mywindow != "undefined") {
mywindow.close();
}
}
}

Also, before popping up your window, call ClosePop(). This will assure
that you only have one popup open... assuming you always call your
popup mywindow.
On Sun, 15 Feb 2004 16:03:53 GMT, "David W. Simmonds"
<da***@simmonds.ca> wrote:
I have a popup window appear when a user clicks on a hyperlink in a
datalist. I do it like this:

dr[8] = "javascript:mywindow=window.open(" +
"\"GameStats.aspx?Date="+dr[0] + "&Away="+dr[1] + "&Home="+dr[4] + "\"" +


",\"GamesStats\",\"toolbar=no,location=no,directo ries=no,menubar=no,resizab

l
e=yes,scrollbars=yes,width=640,height=300\");mywi ndow.focus();";

dr[8] is a DataRow item that is added to a DataTable that becomes the
DataSource of the DataGrid.

Is there a way to have that window close when the form that caused it to
appear closes?

Nov 18 '05 #3

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

Similar topics

1
by: SledgeHammer | last post by:
Hi group, Little question that bugs me .... I have a page (window) with frames. Topframe + MainFrame = page I want to close the whole window, but don't know how Can somebody help me with...
7
by: Jens Peter Hansen | last post by:
Hi From my main window I open a series of popup (one close - next opens) in a mockup for a registration proces. From the last popup, I want to click a buttom, so the popup closes and the URL in...
4
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when...
4
by: moose | last post by:
OK Popup window? No problem PDF in popup? No problem But what about a couple of Close Window buttons? Imagine a "Close Window" button at the top of the popup page. Then the PDF which can...
2
by: David | last post by:
Hey all, I have a script that dynamically sets the window.onunload of the current window to point to a function that, when run, will close another dependent window (if it's opened). This works...
1
by: dibyendu_k | last post by:
Hi, There is a problem i cant solve regarding Internet Explorer 5.5. It is regarding the Print Dialog Box. From a webpage if I open a popup window (window.open()) containing buttons Print and...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
5
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any...
2
by: kurt sune | last post by:
Hello, I have a weird problem, I hope someone can explain this for me. I have a webpage using masterpage. In it I create a popup window using this code: Dim js As String = "<script...
1
by: dittu | last post by:
How to close the popup window when submitting the form? I have a sample.jsp. In that page one button is there. when button pressed, open popup window contains one "text box" and one " submit...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.