HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old November 5th, 2004, 09:17 PM
laura.geldart laura.geldart is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 laura.geldart User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Javascript close all windows

How can I close two windows with one click, I've got a pop-up navigation, and I want a "Close Window" in that pop-up that will close it, AND the main page that it is loading the content into.
This is the code for my pop-up:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
	 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Geldart, Laura - 100238543 - Assignment 4 (Working with Windows) - JAVA2301</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script language="Javascript" type="text/javascript">
<!--
contentArray = new Array("","page1.html","page2.html");
function updateParent(thisPage) {
opener.document.location.  href = 
contentArray[thisPage];
}
function confirm() {
var check = confirm('Close all windows?');
if (check) {
window.close();
}
else {
return false;
}
}
function closeAll() {
if (updateParent && !updateParent.closed) {
updateParent.close();
window.close();
}
else {
window.close();
}
}
-->
</script>
</head>
<body bgcolor="#ff88bb" onbeforeunload="confirm()">
<p class="pageTitle">Control Panel</p>
<p class="navText"><a href="javascript: updateParent(1)">Load Page 1</a></p>
<p class="navText"><a href="javascript: updateParent(2)">Load Page 2</a></p>
<p class="navText"><a href="javascript: closeAll()">Close Windows</a></p>
</body>
</html>

Reply With Quote
  #2  
Old November 6th, 2004, 12:39 PM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information.
 
Join Date: Sep 2004
Location: Israel
Posts: 26,621 Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 7th Grade (Above 100000 Reputation Level)  Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1Folding Points: 325693 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 1 Week 4 Days 13 h 47 m 29 sec
Reputation Power: 1441
for IE browser:
Code:
<input type="button" value="Close" onclick="opener.opener=opener; opener.close(); self.close();" />

clicking this button in the popup window should close its opener and the popup itself.
in Firefox or any sane browser it's not possible though.

Reply With Quote
  #3  
Old November 9th, 2006, 05:35 AM
omprakash omprakash is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2006
Location: Mumbai
Posts: 2 omprakash User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 4 sec
Reputation Power: 0
Send a message via MSN to omprakash Send a message via Yahoo to omprakash
Quote:
Originally Posted by Shadow Wizard
for IE browser:
Code:
<input type="button" value="Close" onclick="opener.opener=opener; opener.close(); self.close();" />

clicking this button in the popup window should close its opener and the popup itself.
in Firefox or any sane browser it's not possible though.


Thanks its working.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Javascript close all windows


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway