iframe標籤快速使用

iframe,頁面框架,可實現不刷新,在局部打開新頁面展示數據

代碼示例:

<div class="left">
    <ul id="menu">
        <li><a href="person/newslist" target="mainFrame">信息管理</a></li>
        <li><a href="person/pwdedit" target="mainFrame">密碼修改</a></li>
    </ul>
</div>

<div class="right">
    <iframe name="mainFrame" src="" style="border: 0px;height: 100%;width: 100%"></iframe>
</div>

Java跳到指定位置 :

String script = "<script>parent.window.location.href='" + request.getContextPath() + "/login'</script>";

try {
    PrintWriter out = response.getWriter();
    out.print(script);
    out.close();
} catch (IOException e) {
    e.printStackTrace();
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章