The difference between frame and iframe tags

巴扎黑
Release: 2018-05-11 17:41:12
Original
2198 people have browsed it

1. Frame cannot be used alone without frameSet, iframe can;

2. Frame cannot be placed in body; it can be displayed normally as follows:

<!--<body>--> 
<frameset rows="50%,*"> 
   <frame   name="frame1"   src="test1.htm"/>  
   <frame   name="frame2"   src="test2.htm"/>  
</frameset> 
<!--<body>-->
Copy after login

The following cannot be displayed normally:
##

<body> 
<frameset rows="50%,*"> 
   <frame   name="frame1"   src="test1.htm"/>  
   <frame   name="frame2"   src="test2.htm"/>  
</frameset> 
<body>
Copy after login

3. Nested in frameSet The iframe must be placed in the body; the following can be displayed normally:

<body> 
    <frameset>  
      <iframe   name="frame1"   src="test1.htm"/>  
      <iframe   name="frame2"   src="test2.htm"/>  
    </frameset>  
  </body>
Copy after login

The following cannot be displayed normally:

 <!--<body>--> 
    <frameset>  
      <iframe   name="frame1"   src="test1.htm"/>  
      <iframe   name="frame2"   src="test2.htm"/>  
    </frameset>  
  <!--</body>-->
Copy after login

4. iframes that are not nested in frameSet can be used at will;
The following can be displayed normally:

<body> 
   <iframe   name="frame1"   src="test1.htm"/>  
   <iframe   name="frame2"   src="test2.htm"/>  
</body> 
<!--<body>--> 
   <iframe   name="frame1"   src="test1.htm"/>  
   <iframe   name="frame2"   src="test2.htm"/>  
<!--</body>-->
Copy after login

5. The height of the frame can only be controlled through frameSet; iframe can be controlled by itself, not through frameSet, such as:

<!--<body>--> 
<frameset rows="50%,*"> 
   <frame   name="frame1"   src="test1.htm"/>  
   <frame   name="frame2"   src="test2.htm"/>  
</frameset> 
<!--</body>--> 
<body> 
<frameset> 
   <iframe height="30%"  name="frame1"   src="test1.htm"/>  
   <iframe height="100"  name="frame2"   src="test2.htm"/>  
</frameset> 
</body>
Copy after login

6 . If more than two iframes are used on the same page, it can be displayed normally in IE, but only the first one can be displayed in Firefox; if more than two iframes are used, it can be displayed normally in both IE and Firefox
The above code was tested in IE7 and firefox2.0.
In addition, theft summary from related forums :-)
1 Frame and Iframe can achieve basically the same functions, but Iframe has more flexibility than Frame.
frame is the frame of the entire page, iframe is an embedded web page element, which can also be said to be an embedded frame
The Iframe tag is also called floatingFrame tag, you can use it to embed a HTML document in an HTML display. The biggest difference between it and the Frame tag is that the content contained in embedded in the web page is an integral part of the entire page, while the content contained in is an independent Individuals can be displayed independently. In addition, using Iframe can also display the same content multiple times on the same page without having to repeat the code of this content.
2iframe can be placed in form. frame does not work.

<table> 
<tr> 
<td><iframe id="" src=""></iframe></td><td></td> 
</tr> 
</table>
Copy after login

3frame必须在frameset里 
而frameset不能与body元素共存,也就说有frameset元素的文档只能是一个框架集,不能有别的东东 
4IFrame是放在网业的什么地方都行   
  但是frame只能放到上下左右四个方向 
5iframme   是活动帧   
  而frame是非活动帧   
  iframe使用方法如下   
   
iframe用起来更灵活,不需要frame那么多讲究   
而且放的位置也可以自己设 
iframe是内嵌的,比较灵活,不过也有不好的地方,就是位置在不同的浏览器和分辨率下有可能不同,有时会把本来好好的页面搞得变形 
iframe就没有这个限制 
6iframe   可以加在网页中任何一个地方。   
  而frame   通常做框架页 
iframe是一个网页中的子框架,两网页间是父子关系   
  frame是框架,由多个并列的网页构成 
楼上的说得对,iframe是浮动的。就像是浮动面板,而frame是固定的。只能四个方向上的。   
你可以直接在网页里用一下,看看效果就行了。 
7