[thelist] Closing a window with JavaScript
Tom Dell'Aringa
pixelmech at yahoo.com
Wed Aug 21 12:19:01 CDT 2002
Craig,
Here is the code you need below. The key is referring to the window
you opened - everything in JS is correct references. Test it out, the
window will open a Google window, do a bogus search (the page
changes). Then click the close button on the opener page. VIola!
Tom
------------------
<html>
<head>
<script>
function launch(newURL, newName, newFeatures, orgName) {
var remote = open(newURL, newName, newFeatures);
if (remote.opener == null)
remote.opener = window;
remote.opener.name = orgName;
return remote;
}
function launchRemote() {
myRemote = launch("http://www.google.com/", "myRemote",
"height=400,width=400", "myWindow");
}
function closeIt()
{
//myRemote.location.href = "http://www.yahoo.com/";
if (window.myRemote) myRemote.close();
}
</script>
</head>
<body>
<input type="button" onclick="launchRemote();" value="launch"><br />
<input type="button" onclick="closeIt()" value="close">
</body>
</html>
=====
var me = tom.pixelmech.webDeveloper();
http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
More information about the thelist
mailing list