Click to See Complete Forum and Search --> : Changing the parent with the child


Wallee
12-07-2002, 06:45 PM
:confused: I know that I can use "_blank" to open another window when a link is clicked, but whenever a link inside that window is clicked, the resultant page is opened inside that same window (or another). How can I make it so that when a link is clicked inside the newly opened window, the window closes and the desired page comes up in the original main window? Does anybody know how this can be done?

Stefan
12-07-2002, 06:50 PM
Originally posted by Wallee How can I make it so that when a link is clicked inside the newly opened window, the window closes and the desired page comes up in the original main window? Does anybody know how this can be done? [/B]

You need to make the first page loaded in a frameset (you can have frameset with only 1 frame).
Then you specify a name for that frame, eg main.

Then you make your link in your new page target="main".

You can find specifics here
http://www.w3.org/TR/html4/present/frames.html

Altearnativly you can do it with JavaScript too, but that will break if JavaScript is not available in the visitors browser.

Wallee
12-07-2002, 07:05 PM
Thanks

Stefan
12-07-2002, 08:20 PM
Originally posted by Dave Clark
I have never seen a target that is able to find a named frame that is not in the same browser window.

Take a peak at this code then for a new experience ;)

Index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
</head>
<frameset border="0"> <!-- border="0" is a bugfix for IE, NS as well as Opera -->
<frame name="main" src="initial.html" frameborder="0" marginwidth="1" marginheight="1" scrolling="auto" />
<noframes>
<body>
<p>
Frames are not working in your Browser.<br />
If you have Frames turned off, please turn it on to view this site.
</p>
</body>
</noframes>
</frameset>
</html>


initial.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title></title>
</head>
<body>

<p>
<a target="_blank" href="blank.html">open _blank</a>
</p>

</body>
</html>


blank.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title></title>
<link rel="stylesheet" title="Default" media="screen" href="main.css" type="text/css" />
</head>
<body>

<p>
<a target="main" href="blank.html">open in main</a>
</p>

</body>
</html>