1.跳到另一個頁面的兩種方法:
window.location.href = '1.html'
window.location.reload('11.html')
2.如果使用了架構,但是又想跳到一個頁面,而不是在架構指定的頁面顯示,如何操作。
parent.document.location.href="./frontstage/login.jsp";
3.用JavaScript重新整理上級頁面和當前頁面
window.parent.main.document.location.reload();//上級頁面
document.location.reload();//當前頁面
4.每個frame元素或者iframe元素就是一個架構,這個架構是一個視窗,在這個視窗中載入一個html文檔.使用下面的幾種方法都可以引用frame或iframe元素:
window.frames[index]
windows.frames["架構名"]
windows.架構名
6.如果想從架構所載入的網頁中擷取對父視窗的引用,那麼就可以使用下面的方法:
window.parent
7.如果要對父視窗中某個架構的引用,那麼就可以使用下面的方法:
window.parent.架構名
也可以使用下面的方法擷取對父視窗的最頂端架構的引用:
window.top
8.html 如何將新的網頁檔案在架構Frame中開啟
第一種方法為: window.open('Url',MainFrame,'width=......,height=....');
其中:Url :需要開啟的頁面; MainFrame :裝載(包含)這個頁面的架構 ; width=......,height=....:頁面的風格設定
另外一種方法為: MainFrame.document.location = "Url"; 即直接指定MainFrame的url指向為 某個url。
當然類似的也可以用 document.getElementById("MainFrame").src = "Url";
第一種方法是被動式的指定某個頁面要載入到哪個架構內; 後兩種方法主動的設定架構將要載入哪個頁面
10.html執行個體參考參考:(這個執行個體是左右架構結構);這種開啟檔案只用frame的name 屬性即可 指定開啟位置
_blank 在新的瀏覽器視窗中開啟連結的文檔,同時保持當前視窗不變。
_parent 在顯示連結的架構的父框架組中開啟連結的文檔,同時替換整個框架組。
_self 在當前架構中開啟連結,同時替換該架構中的內容。
_top 在當前瀏覽器視窗中開啟連結的文檔,同時替換所有架構。
1.主架構頁面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
</head>
<frameset rows="*" cols="138,*" framespacing="1" frameborder="yes"
border="1" bordercolor="#000000">
<frame src="left.html" name="leftFrame" scrolling="No"
noresize="noresize" id="leftFrame" /> <frame src="right.html"
name="mainFrame" id="mainFrame" />
</frameset>
<noframes>
<body></body>
</noframes>
</html>
2。左架構頁面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
</head>
<body link="black" vlink="olive" alink="blue">
<p>
<a href="我的首頁.html" target="mainFrame">我的首頁</a>
</p>
<p>
<a href="我的日記.html" target="mainFrame">我的日記</a>
</p>
</body>
</html>
3.右架構頁面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
</head>
<body></body>
</html>