Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 28th, 2004, 11:24 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Clsing Parent Framed Window

I have an main page that in comprised of 2 frames, I want to be able to close the main page from a button from the top frame page. Is it possible? My main page is:
<html>

<head>
  <title></title>
</head>
<frameset rows="5%,*" border="0">
    <frame name="maintop" src="maintop.shtml" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
    <frame name="main" src="main.shtml" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
</frameset>
My Maintop page is:
<html>

<head>
  <title></title>
</head>

<SCRIPT LANGUAGE="JavaScript">
function goHist(a)
{
   history.go(a); // Go back one.
}
</script>
<center><FORM METHOD="post">
<INPUT TYPE="button" VALUE=" BACK " onClick="goHist(-1)">
<INPUT TYPE="button" VALUE="FORWARD" onClick="goHist(1)">


</form></center>
 
Old October 28th, 2004, 04:46 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Add this to your top page:

<input type='button' value='Close' onclick='parent.window.close()'/>

-Snib
Where will you be in 100 years?
Try new FreshView 0.2!
There are only two stupid questions: the one you can't find the answer to and don't ask, and the one that you can find the answer and do ask.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Centering Popup window & Blur Parent window jkusmanto Javascript How-To 0 May 25th, 2007 03:19 AM
closed parent window when opened child window jaiwin Javascript How-To 0 October 8th, 2006 12:54 PM
Transfer value from framed popup to framed mainpag wester Javascript How-To 1 December 27th, 2004 03:56 PM
Window.open from OnClick event in framed env. nancy Javascript How-To 3 December 22nd, 2004 11:30 AM
Close Parent window on opening child window pkdev Javascript How-To 8 April 11th, 2004 12:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.