雜項
說明 <!-- *** --> (瀏覽器不會顯示)
檔案型態聲明 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
3.0 檔案型態聲明 <!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 3.0//EN">
可搜尋 <ISINDEX> (指示可搜尋的索引項)
N1.0 提示 <ISINDEX PROMPT="***"> (要求輸入的提示文字)
送出搜尋條件 <A HREF="URL?***"></a> (其中的問號不是數字,而是「問號」)
基本檔案的URL <BASE HREF="URL"> (必須放在「文頭」區段內)
N2.0 基本視窗名稱 <BASE TARGET="***"> (必須放在「文頭」區段內)
相關性 <LINK REV="***" REL="***" HREF="URL"> (必須放在「文頭」區段內)
背景資訊 <META> (必須放在「文頭」區段內)
浮動幀標記IFRAME,空姐看來哦[/COLOR]
你的網頁中一定有Banner,欄目圖片,版權等一大堆雷同的東西,出于網站風格統一,本無可厚非,但是有沒有辦法,讓這些雷同的東西一次下載后就不用再下載,而只下載那些內容有變化區域的網頁內容呢? 人們首先想到了幀標記Frame,將整個頁面劃分為若干幀。可是Frame卻不能隨意指定幀的位置,它至少要有一條邊與頁面的四邊重合,靈活性大受影響。為了能在頁面的任何位置嵌入HTML文件,我們可以使用幀標記frame的兄弟浮動幀標記Iframe,雖然Nestscape瀏覽器不支持Iframe標記,但在時下IE的天下,這似乎也無大礙。
Iframe標記,又叫浮動幀標記,你可以用它將一個HTML文件嵌入在另一個HTML中顯示。它不同于Frame標記最大的特征即這個標記所引用的HTML文件不是與另外的HTML文件相互獨立顯示,而是可以直接嵌入在一個HTML文件中,與這個HTML文件內容相互融合,成為一個整體,另外,還可以多次在一個頁面內顯示同一內容,而不必重復寫內容,甚至可以在同一HTML文件嵌入多個HTML文件。
在腳本語言與對象層次中,包含Iframe的窗口我們稱之為父窗體,而浮動幀則稱為子窗體,弄清這兩者的關系很重要,因為要在父窗體中訪問子窗體或子窗體中訪問父窗體都必須清楚對象層次,才能通過程序來訪問并控制窗體。
下面是浮動幀標記Iframe的各項屬性:
一、基本語法:
<iframe>……</iframe>
浮動幀標記Iframe必須成對出現,即有開始標記<iframe>,就必須有結束標記</iframe>。
二、浮動幀標記Iframe的屬性:
1、文件位置:
語法:src=url
說明:url為嵌入的HTML文件的位置,可以是相對地址,也可以是絕對地址。
示例:<iframe src="iframe.html">
2、對象名稱:
語法:name=#
說明:#為對象的名稱。該屬性給對象取名,以便其他對象利用。
示例:<iframe src="iframe.html" name="iframe1">
3、ID選擇符:
語法:id=#
說明:指定該標記的唯一ID選擇符。
示例:<iframe src="iframe.html" id="iframe1">
4、容器屬性:
語法:height=# width=#
說明:該屬性指定浮動幀的高度和寬度。取值為正整數(單位為像素)或百分數。
height:指定浮動幀的高度;
width:指定浮動幀的寬度。
示例:<iframe src="iframe.html" height=400 width=400>
5、尺寸調整:
語法:noresize
說明:IE專有屬性,指定浮動幀不可調整尺寸。
示例:<iframe src="iframe.html" noresize>
6、邊框顯示:
語法:frameborder=0、1
說明:該屬性規定是否顯示浮動幀邊框。
0:不顯示浮動幀邊框;
1:顯示浮動幀邊框。
示例:<iframe src="iframe.html" frameborder=0>
<iframe src="iframe.html" frameborder=1>
7、邊框厚度:
語法:border=#
說明:該屬性指定浮動幀邊框的厚度,取值為正整數和0,單位為像素。為了將浮動幀與頁面無縫結合,border一般等于0。
示例:<iframe src="iframe.html" border=1>
8、邊框顏色:
語法:bordercolor=color
說明:該屬性指定浮動幀邊框的顏色。color可以是RGB色(RRGGBB),也可以是顏色名。
示例:<iframe src="iframe.html" bordercolor=red>
9、對齊方式:
語法:align=left、right、center
說明:該屬性指定浮動幀與其他對象的對齊方式。
left:居左;
right:居右;
center:居中。
示例:<iframe src="iframe.html" align=left>
<iframe src="iframe.html" align=right>
<iframe src="iframe.html" align=center>
10、相鄰間距:
語法:framespacing=#
說明:該屬性指定相鄰浮動幀之間的間距。取值為正整數和0,單位為像素。
示例:<iframe src="iframe.html" framespacing=10>
11、內補白屬性:
語法:hspace=# vspace=#
說明:該屬性指定浮動幀內的邊界大小。取值為正整數和0,單位為像素。兩個屬性應同時應用。
hspace:浮動幀內的左右邊界大小;
vspace:浮動幀內的上下邊界大小。
示例:<iframe src="iframe.html" hspace=1 vspace=1>
12、外補白屬性:
語法:marginheight=# marginwidth=#
說明:該屬性指定浮動幀的邊界大小。取值為正整數和0,單位為像素。兩個屬性應同時應用。
marginheight:浮動幀的左右邊界大小;
marginwidth:浮動幀的上下邊界大小。
示例:<iframe src="iframe.html" marginheight=1 marginwidth=1>
——iframe使用語法
<!ELEMENT IFRAME - - (%flow* -- inline subwindow -->
<!ATTLIST IFRAME
%coreattrs; -- id, class, style, title --
Longdesc %URI; #IMPLIED -- link to long description
(complements title) --
Name CDATA #IMPLIED -- name of frame for targetting --
Src %URI; #IMPLIED -- source of frame content --
Frameborder (1|0) 1 -- request frame borders? --
Marginwidth %Pixels; #IMPLIED -- margin widths in pixels --
Marginheight %Pixels; #IMPLIED -- margin height in pixels --
Scrolling (yes |no | auto) auto -- scrollbar or none --
Align %IAlign; #IMPLIED -- vertical or horizontal alignment --
Height %Length; #IMPLIED -- frame height --
Width %Length; #IMPLIED -- frame width --
>
Attribute definitions
Name = cdata [CI]
This attribute assigns a name to the current frame. This name may be used as the target of subsequent links.
longdesc = uri [CT]
This attribute specifies a link to a long description of the frame. This description should supplement the short description provided using the title attribute, and may be particularly useful for non-visual user agents.
src = uri [CT]
This attribute specifies the location of the initial contents to be contained in the frame.
noresize [CI]
When present, this boolean attribute tells the user agent that the frame window must not be resizeable.
scrolling = auto|yes|no [CI]
This attribute specifies scroll information for the frame window. Possible values
auto: This value tells the user agent to provide scrolling devices for the frame window when necessary. This is the default value.
yes: This value tells the user agent to always provide scrolling devices for the frame window.
no: This value tells the user agent not to provide scrolling devices for the frame window.
frameborder = 1|0 [CN]
This attribute provides the user agent with information about the frame border. Possible values:
1: This value tells the user agent to draw a separator between this frame and every adjoining frame. This is the default value.
0: This value tells the user agent not to draw a separator between this frame and every adjoining frame. Note that separators may be drawn next to this frame nonetheless if specified by other frames.
marginwidth = pixels [CN]
This attribute specifies the amount of space to be left between the frame's contents in its left and right margins. The value must be greater than zero (pixels). The default value depends on the user agent.
marginheight = pixels [CN]
This attribute specifies the amount of space to be left between the frame's contents in its top and bottom margins. The value must be greater than zero (pixels). The default value depends on the user agent.
Attributes defined elsewhere
id, class (document-wide identifiers)
title (element title)
style (inline style information)