使用frameset框架會出現很多問題,最典型的是需要頁面跳轉時,僅僅只是內部頁面的跳轉,而不是整個的瀏覽器跳轉,
不要使用location.href 而是使用 window.top.location.href
"window.location.href"、"location.href"是本頁面跳轉.
"parent.location.href" 是上一層頁面跳轉.
"top.location.href" 是最外層的頁面跳轉.
舉例說明:
如果A,B,C,D都是html,D是C的iframe,C是B的iframe,B是A的iframe,如果D中js這樣寫
"window.location.href"、"location.href":D頁面跳轉
"parent.location.href":C頁面跳轉
"top.location.href":A頁面跳轉
如果D頁面中有form的話,
<form>: form提交後D頁面跳轉
<form target="_blank">: form提交後彈出新頁面
<form target="_parent">: form提交後C頁面跳轉
<form target="_top"> : form提交後A頁面跳轉