js 跳出frameset框架

来源:互联网 发布:一键复制宝贝网站源码 编辑:程序博客网 时间:2024/05/14 14:19

框架页面(system_index.jsp):

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>天津市档案局业务指导平台</title>

</head>
<FRAMESET border=0 frameSpacing=0 rows="75,*" frameBorder=0>
    <FRAME name=header src="<%=basePath%>/system/top.jsp" frameBorder=0
        noresize="noresize" scrolling=no>
    <FRAMESET cols="199,*">
        <FRAME name=menu src="<%=basePath%>/system/left.jsp" frameBorder=0 noresize="noresize"
            scrolling="auto">
        <FRAME name=main src="<%=basePath%>/system/first.jsp" frameBorder=0 noresize="noresize"
            scrolling="auto">
    </FRAMESET>
</FRAMESET>
<noframes>
</noframes>
<body></body>
    </noframes>

</html>

top页面(top.jsp):

<%@ page language="java"
    import="java.util.*,com.businessguidance.common.pojo.*"
    pageEncoding="utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<style type="text/css">
body {
    margin: 0;
    padding: 0;
    background-color: #2e7ba5;
}

a {
    text-decoration: none;
    font-family: 微软雅黑;
    font-size: 13px;
    color: #FFFFFF;
}

.top {
    width: 100%;
    height: 75px;
    background: url(images/r1_c1.jpg);
    background-repeat: no-repeat;
}

.STYLE1 {
    float: right;
    margin-top: 38px;
    margin-right: 18px;
    height: 75px;
    font-size: 13px;
    color: #FFFFFF;
}
</style>
<%
    Public_Reguserinfo user = null;
    Object pr = session.getAttribute("user");
    if (pr != null) {
        user = (Public_Reguserinfo) pr;
    } else {
        out.println("<script>window.parent.open('../index.jsp','_self');</script>");
    }
%>

<div class="top">
    <div class="STYLE1">
        <a href="#">
            <%
                if (user != null) {
            %><%=user.getName()%>
            <%
                }
            %>
        </a> | <a href="<%=basePath%>index.jsp" target="_parent">
        <%
                if (user != null) {
            %>
            退出
            <%
                }else{
            %>
            重新登陆
            <%} %>
        </a> |<a
            href="tskjapp://rtx">腾讯通</a>
    </div>
</div>



在top页面中判断session,当session为空的时候,直接跳出当前框架,要执行脚本:

<script>window.parent.open('../index.jsp','_self');</script>

0 0