iframe中如果只是頁面跳轉的話,我們依然只是部分的加載的了,為了實現整個頁面的所有內容跳轉,下面提供了整個頁面跳轉的方法。
iframe例子
1、總的iframe頁面(訪問就訪問這個) all.html
<frameset rows="45%,*" frameborder=0 framespacing=10> <frame src="top.html" noresize/> <frameset cols="20%,*" > <frame src="left.html" noresize/> <frame src="right1.html" name="right"/> </frameset> </frameset>
2、top.html (上不的頁面)
<html> <body> <img src="1111.jpg" width=410/> </body> </html>
3、left.html (左下方的頁面)
<body bgcolor="pink"> <a href="right1.html" target="right">清華1</a><br> <a href="right2.html" target="right">清華2</a><br> <a href="login.html" target=_top>退出</a> <!-- 這個會跳出整個頁面 -->
<a href="#" onclick="top.location.href='login.html'">退出2</a> <!-- 這個會跳出整個頁面 -->
</body> </html>
4、right1.html (右下方頁面1)
<html> <body bgcolor="green"> right1 </body> </html>
5、right2.html (右下方頁面2)
<html> <body> right2 </body> </html>
6、login.html
<html> <body> 登陸界面 </body> </html>
7、效果圖
整個頁面跳轉——實現登陸退出
在手動改HTML代碼時經常會用到target參數,常用的有兩個target=_blank 和target=_self意思為:
target=_blank表示在新窗口中打開該鏈接;
target=_self表示相同框架,即在當前窗口(或當前選項卡)中打開該鏈接
還有兩個不常用的:
target=_parent,將鏈接的文件載入含有該鏈接框架的父框架集或父窗口中。如果含有該鏈接的框架不是嵌套的,則在瀏覽器全屏窗口中載入鏈接的文件,就象_self參數一樣。
target=_top,在當前的整個瀏覽器窗口中打開所鏈接的文檔,因而會刪除所有框架
不寫的話就是表示默認值,默認值一般跟瀏覽器有關。
比如網A中鑲嵌iframe了網頁B,網頁B又鑲嵌iframe了網頁C
如果網頁C中連接設置target=_parent,則跳將網頁B去掉直接A中嵌入網頁C中鏈接頁面;
而如果網頁C中target=_top ,則直接跳出所有iframe框架,直接轉向C中鏈接頁面。
如果是在iframe中退出登錄,這樣就可以了。Response.Write("<script>top.location.href=\"/Login.aspx\"</script>");
致謝:感謝您的耐心閱讀!