2016-08-01 53 views
0

我正在使用框架进行首次。这里是链接在底部框架中未正确打开

的index.html

<!DOCTYPE html> 
<html> 
<head> 
<title></title> 
</head> 
<frameset rows="20%,*"> 
    <frame name="top" src="top.html" name="topmenu" /> 
    <frame name="main" src="content.html" name="content" /> 
    <noframes> 
    <body> 
     Your browser does not support frames. 
    </body> 
    </noframes> 
</frameset> 
</html> 

的top.html

<html> 
<head></head> 
<body> 

<div id="container"> 
    <!-- begin navigation --> 
    <nav id="navigation"> 
     <ul>        
      <li><a href="contact.html" target="content">Contact</a></li> 
     </ul> 
    </nav> 
    <!-- end navigation --> 
</div> 
</body> 
</html> 

content.html

<html> 
    <head></head> 
<body> 
    Some Content 
</body> 
<html> 

contact.html

<html> 
    <head></head> 
<body> 
    Contact page 
</body> 
<html> 

这样,输出是下

enter image description here

现在,当我点击联系链接上,而不是显示在content.html内容,它在新标签中打开,如下

enter image description here

我正在犯什么错误。我相信在我选择合适的目标时存在一些问题

请帮忙。

在此先感谢。

回答

0

的帧不是HTML5 ^支持,它是过时,并得到它的工作的<!DOCTYPE>必须被设置为HTML Frameset DTDXHTML Frameset DTD

如果在此jsFiddle检查HTML设置你会看到,我已设置的DOCTYPE为“HTML 4.01框架集”,以使其工作,因为这形象:

enter image description here

** 另请注意您已在每个frame标记中使用name属性两次,并且应该只有一个!

<frame name="top" src="top.html" name="topmenu" /> 
<frame name="main" src="content.html" name="content" /> 

^来源: