2016-08-01 28 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" /> 

^來源: