- iframe標籤是成對出現的,以<iframe>開始,</iframe>結束
- iframe標籤內的內容可以做爲瀏覽器不支持iframe標籤時顯示
- 引用網址:http://www.dreamdu.com/xhtml/tag_iframe/
- 屬性
- Common -- 一般屬性
- name -- 定義了內容頁名稱,此名稱在框架頁內鏈接時使用到
- src -- 定義了內容頁URL(同frame標籤)
- frameborder -- 定義了內容頁的邊框,取值爲(1|0),缺省值爲1
- 1 -- 在每個頁面之間都顯示邊框
- 0 -- 不顯示邊框
- height -- 框架的高度,取值像素或百分比
- width -- 框架的寬度,取值像素或百分比
- marginwidth -- 定義了框架中HTML文件顯示的左右邊界的寬度,取值爲px,缺省值由瀏覽器決定
- marginheight -- 定義了框架中HTML文件顯示的上下邊界的寬度,取值爲px,缺省值由瀏覽器決定
- scrolling -- 定義是否有滾動條,取值爲(yes|no|auto),缺省值爲auto
- yes -- 顯示滾動條
- no -- 不顯示滾動條
- auto -- 當需要時再顯示滾動條
- align -- 垂直或水平對齊方式
- longdesc -- 定義框架頁的說明
頁面:000.html
<html>
<head>
<script type="text/javascript">
function temp(id) {
document.getElementById("temp").src = id;
}
function temps(id) {
alert(id);
}
</script>
</head>
<body>
<table align="center">
<tr>
<td>主頁 <a href="#" id="111.html" onclick="temp(this.id);" >111</a> <a href="#" id="222.html" onclick="temp(this.id);" >222</a></td>
</tr>
<tr>
<td ><Iframe id="temp" src="111.html" width="500" heitht="600">aa</IFRAME></td>
</tr>
</table>
</body>
</html>
111.html
<html>
<body>
這是默認的第一個子頁面
</body>
</html>
222.html
<html>
<body>
第二個子頁面
<a href="#" id="111.html" onclick="window.parent.temp(this.id);" > 進入主頁面000</a>
</body>
</html>
說明:直接把三個文件以html的格式放在桌面即可,此時document.getElementById("temp")在ie裏面可以,在火狐裏面要改爲name這樣就都可以了。在項目裏面要都用id了.