js 跳出frameset框架

5 篇文章 0 订阅

框架页面(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
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

spjhandsomeman

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值