Search code examples
htmlframeset

HTML.link from a frame to another opens in new window?How can i fix it?


i want to have a link in frame a and open in frame b without opening new window.

heres my code:

<html>
<base target="main.htm">
<body>
  <body link="blue" vlink="rgb(255,200,0)" alink="green" style="background-color:rgb(255,30,15)">
    <h2><b>ΠΕΡΙΕΧΟΜΕΝΑ</b></h2>
    <a href="personal.htm" target="main" border="0">ΠΡΟΣΩΠΙΚΑ ΣΤΟΙΧΕΙΑ </a><br/>
  <body/>
<html/>

Solution

  • Firstly I would suggest a valid doctype declaration, unless of course you're going for HTML5.

    Secondly, I would suggest your enclose your <base> tag inside <head></head> tag

    Thirdly, if you're using either XHTML or HTML 5 (as it seems you're currently doing), you will need to close your <base> tag with </base>

    As for answering your actual question, you'll need to use the target attribute, as follows:

    <base target="main.htm" target="_parent">
    

    Please note that, as far as I know you can't have a link from Frame A open in Frame B, unless it's a parent frame - if you understand what I mean. To get a full understanding of what the target attribute does, check out this link.