日期:2014-05-16  浏览次数:20515 次

js页面跳转的问题(跳转到父页面,跳转到最外层页面)

?

" window.location.href "" location.href "本页面跳转

" parent.location.href "上一层页面跳转

"top.location.href"最外层的页面跳转

举例说明:

如果A,B,C,D都是jsp,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页面跳转

?

if(window.top.location.href!=location.href){
??? ??? window.top.location.href=location.href;

?}

如果D页面中有form的话,

<form>: form提交后D页面跳转

<form target="_blank">: form提交后弹出新页面

<form target="_parent