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:
  #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
ASP Free God 47th Plane (28000 - 28499 posts)
 
Join Date: Sep 2004
Location: Israel
Posts: 28,432 Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 18th Grade (Above 100000 Reputation Level)  Folding Points: 478881 Folding Title: Super Ultimate Folder - Level 1Folding Points: 478881 Folding Title: Super Ultimate Folder - Level 1Folding Points: 478881 Folding Title: Super Ultimate Folder - Level 1Folding Points: 478881 Folding Title: Super Ultimate Folder - Level 1Folding Points: 478881 Folding Title: Super Ultimate Folder - Level 1Folding Points: 478881 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 1 Day 1 h 1 m 6 sec
Reputation Power: 2190
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



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT