
November 5th, 2004, 09:17 PM
|
|
Registered User
|
|
Join Date: Nov 2004
Posts: 3
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>
|