10.4.1 Frameset与Frame的区别首先讲解Frameset与Frame之间的区别。 用来划分框架,每一个框架由标记。必须在之内使用,代码如下: 在上面的例子当中,把页面分为左右两个部分,左侧框架中的页面是admin_left.htm,右侧框架中的页面是admin_center.htm。 注意:标记的框架顺序为从左至右或从上到下。 两者的差别如下: ● 为框架标记,说明该网页文档为框架组成,并设定文档中组成框架集的框架的布局。 ● 用以设置组成框架集中各个框架的属性。 10.4.2 Frameset参数设置需要设置一些特定的参数,这些参数直接决定了整个页面的布局,代码如下: 关于上段代码的各项参数设置及其含义如表10.3所示。 表10.3 Frameset参数 参 数 说 明 Border 设定框架的边框厚度,以pixels为单位 frameborder 设定是否显示框架的边框,0为不显示,1为显示 FrameSpacing 表示框架与框架之间的距离 BorderColor 设定框架的边框颜色 Row 将文档分为上下的框架,Row后的值可以为数值或百分数,*表示占用余下的空间,数值的个数代表水平分成的框架个数,例如Rows=“210,*,10%”,表示页面分为上中下三个框架页,上边的框架占用210px,下边的框架占用整个文档的10%,余下的空间为中间的框架占用。*是一个相对的概念,例如Row=*,表示页面中没有上下结构的框架布局 Cols 设置同Row 10.4.3 Frame参数设置 关于Frame参数的设置,代码如下: 如表10.4所示。 表10.4 Frame参数 参 数 说 明 Name 设定框架的名称,须为英文 Src 设置框架中显示的页面路径和名称,可为相对路径亦可为绝对路径 Marginwidth 表示框架距离左右边缘的距离 Marginheight 表示框架距离上下边缘的距离 Scrollling 设置是否在框架中显示滚动条,yes为显示,no为不显示,auto表示当框架页中内容超过框架的大小时自动显示滚动条 Frameborder 设置是否显示框架的边框,0为不显示,1为显示 Noresize Set whether the user can change the size of this frame. If this is not set, the viewer can pull the frame and change the size of the frame Framespacing Indicates the distance between frames Bordercolor Set the border color of the frame 10.4.4 The difference between Frame and Iframe Frame and Iframe can achieve basically the same functions, but Iframe has more flexibility than Frame. Iframe tag is also called floating frame tag, which can be used to embed an HTML document in an HTML for 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. The page shown in Figure 10.21 uses Iframe to create paginated links at the top and bottom of the page. The code for the top and bottom is the same. You only need to embed the same file in the web page. There is no need to repeat the writing of the code. For the actual effect of the case, please refer to the case/frame/iframe/see_infomore_iframe.htm in the accompanying CD. 10.4.5 Set Iframe transparency An even bigger benefit of Iframe is that you can set the frame to be transparent so that the background in the frame is the same as the background of the main page. In the above example operation, careful readers will find this problem. Here is a detailed explanation of how to set Iframe transparency. The specific steps are as follows: (1) Open the case/frame/iframe/see_infomore_iframe1.htm in the book CD. (2) Browse the page file in the browser and find that the background of the original cell is covered in the area where the Iframe is inserted. This is not the desired effect. (3) Open the page.htm page, switch to the code view, and insert the following code in the tag: Figure 10.21 Using Iframe to create page flips (4) Switch see_infomore_iframe1.htm to the code view and view the code of the cell where the Iframe is inserted on the page as follows: (5) In the tag, The parameter settings and their meanings in the above code allowTransparency="true" (6) The cell code inserted into the Iframe at this time is as follows: (7) Save the two pages page.htm and see_infomore_iframe1.htm, and browse the effect in the browser.