need to close main window

K

kevin dalby

I use the script below to open a side panel on my desktop without all the
buttons and menu items. IE 6
It works well.
What I'd like to add is add a line of code that will close the calling
parent window (right now I make it visible by resizing it and clicking on a
close link). I'll even settle for having to confirm the closure but, the
ultimate would be that it would close by itself.

KD

================================
<html>
<title>MySideBar</title>
<body bgcolor="#FFFFFF" onLoad="OpenSideBar()">
<script language="JavaScript">
<!--
// This function moves the window when the page is loaded
// to the top left corner and resizes it then opens a side window panel
// ideally I want it to close the calling browser window, even if asked to
confirm
//
function OpenSideBar()
{
self.moveTo(0,0)
self.resizeTo(300,300)
window.open("http://www.google.ca","MySideBar","width=150,height=965,left=0,
top=0,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=n
o,fullscreen=no")
}
function CloseWindow()
{
self.close()
}
-->
</script>

<div align="right">
<table border="0">
<tr>
<td><a href=javascript:CloseWindow()> Close Window</a>
</tr>
</table>
</div>
</body>
</html>
 
R

Randy Webb

kevin said:
I use the script below to open a side panel on my desktop without all the
buttons and menu items. IE 6
It works well.
What I'd like to add is add a line of code that will close the calling
parent window (right now I make it visible by resizing it and clicking on a
close link). I'll even settle for having to confirm the closure but, the
ultimate would be that it would close by itself.

KD

================================
<html>
<title>MySideBar</title>
<body bgcolor="#FFFFFF" onLoad="OpenSideBar()">
<script language="JavaScript">
<!--
// This function moves the window when the page is loaded
// to the top left corner and resizes it then opens a side window panel
// ideally I want it to close the calling browser window, even if asked to
confirm
//
function OpenSideBar()
{
self.moveTo(0,0)
self.resizeTo(300,300)
window.open("http://www.google.ca","MySideBar","width=150,height=965,left=0,
top=0,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=n
o,fullscreen=no")
}
function CloseWindow()
{
self.close()
}
-->
</script>

<div align="right">
<table border="0">
<tr>
<td><a href=javascript:CloseWindow()> Close Window</a>
</tr>
</table>
</div>
</body>
</html>

<script type="text/javascript">
window.open("http://www.google.ca","MySideBar","params_here")
window.opener = window;
window.close();
</script>

Is all you need.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top