dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Changing the parent with the child

  1. #1
    Join Date
    Dec 2002
    Posts
    2

    Question Changing the parent with the child

    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?

  2. #2
    Join Date
    Nov 2002
    Posts
    984

    Re: Changing the parent with the child

    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.

  3. #3
    Join Date
    Dec 2002
    Posts
    2
    Thanks

  4. #4
    Join Date
    Nov 2002
    Posts
    984
    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>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles