標籤:nbsp 引用 bsp com 關係 soft forms apt for
js實現頁面的跳轉具體有幾種方法:
location.href :表示當前頁面連結地址
例子:最外層頁面為(main.html首頁面),分上(top.html)頁面,左(left.html)頁面,右(right.html頁)面3個<frame>子頁面,
http://localhost:8080/Spring_shizhan4ban_Chapter05/resources/js/main.html
http://localhost:8080/Spring_shizhan4ban_Chapter05/resources/js/top.html
http://localhost:8080/Spring_shizhan4ban_Chapter05/resources/js/right.html
http://localhost:8080/Spring_shizhan4ban_Chapter05/resources/js/left.html
main.html代碼如下:
<div id="frameset"> <frameset rows="11%,*" > <frame src=top.html name="top" frameborder=0 noresize > <frameset cols="20%,*" name="buttom"> <frame src=left.html name="left" id="left" > <frame src=right.html name="right" id="right" > </frameset> </frameset> </div>
主介面視窗如:
點擊產生密碼在右子視窗進行表單提交:
在點擊確認修改按鈕後的幾種跳轉:
1.在檢查提交時後台表單項檢查不通過,重新整理或者是重新載入右頁面重新輸入:window.location.reload(true);
2.在檢查表單通過時跳轉到登入介面重新登入,那麼這個時候需要將主介面(main.html)置為登入的主介面:top.location="../../home";
其他相關頁面標示符的含義:
1.top
該變更永遠指分割視窗最高層次的瀏覽器視窗。如果計劃從分割視窗的最高層次開始執行命令,就可以用top變數。
2.opener
opener用於在window.open的頁面引用執行該window.open方法的的頁面的對象。例如:A頁面通過window.open()方
法彈出了B頁面,在B頁面中就可以通過opener來引用A頁面,這樣就可以通過這個對象來對A頁面進行操作。
3.parent
parent用於在iframe,frame中產生的子頁面中訪問父頁面的對象。例如:A頁面中有一個iframe或frame,那麼iframe
或frame中的頁面就可以通過parent對象來引用A頁面中的對象。這樣就可以擷取或傳回值到A頁面中。
4.另外self 指的是當前視窗
parent與opener的區別:
parent指父視窗,在FRAMESET中,FRAME的PARENT就是FRAMESET視窗。
opener指用WINDOW.OPEN等方式建立的新視窗對應的原視窗。
parent是相對於架構來說父視窗對象
opener是針對於用window.open開啟的視窗來說的父視窗,前提是window.open開啟的才有
document.parentWindow.menthod()調用父頁面的方法
附:Window對象、Parent對象、Frame對象、Document對象和Form對象的階層關係
Window對象→Parent對象→Frame對象→Document對象→Form對象,
如下: parent.frame1.document.forms[0].elements[0].value;
JS實現頁面跳轉