用框架嵌套框架,session过期用JavaScript跳出到最外层的框架,在定向到登陆页面,
用parent.window.top.location.href=  只能跳出一层框架, 求解?

解决方案 »

  1.   

    parent.parent.location.href = url;
      

  2.   

    parent.parent.location.href = url, 也只能跳出一个框架
      

  3.   

    top.location.href = url; 也只能跳出一个框架 晕啊 
    刚想到 可以设计先关闭这个窗口,再打开一个窗口定向到登陆页面用JS,可是我代码上实现不了,会提示此页面正在关闭浏览器, 帮我实现一种吧?
      

  4.   

    parent.parent.location.href = url
    top.location.href,
    parent.window.top.location.href= 
    你们测试过或曾经用过吗? 都只能跳出一个框架。还是我其他地方有错?
      

  5.   

    套几层就用几个parent
    一般都直接用top.location.href
      

  6.   

    index.jsp页面
    <frameset rows="70,*" cols="*" frameborder="1" border="0" framespacing="1" BorderColor="#7D9EC0">
    <frame src="top.jsp" name="top" scrolling="NO" noresize > 
    <frame src="down.jsp" name="down" scrolling="NO" noresize> 
    </frameset>
    down.jsp<iframe frameBorder="0" id="left" name="left" src="left.jsp"
    height="100%" width="162" >
    </iframe>
    <iframe frameBorder="0" id="main" name="right" scrolling="yes"
    src="index/default.jsp" height="100%" width="100%" target="right"></iframe>
    或者down.jsp
    <frameset rows="90,*" cols="*" frameborder="1" border="0" framespacing="1" BorderColor="#7D9EC0"> 
    <frame src="goodsquery.jsp" name="up" scrolling="NO" noresize > 
    <frame src="queryList.jsp" name="down" noresize > 
    </frameset> 
    这样我这么从queryList.jspsession过期跳到登陆页面啊?
      

  7.   

    我这用下面的这个是可以跳出两层框架的
    parent.parent.location.href = 'xxx.php';
      

  8.   

    是不是所有框架都要写在同一个页面才能跳出来, 我是分不同的页面写的?要实现隐藏左侧菜单栏是不是不能用框架做要用 DIV?
      

  9.   

    两个parent也只能跳出一个框架?不会吧?这是你的个别现象还是普遍现象啊?
      

  10.   

    我不是这样写的页面框架:
    <frameset rows="70,*" cols="*" frameborder="1" border="0" framespacing="1" BorderColor="#7D9EC0">
    <frame src="top.jsp" name="top" scrolling="NO" noresize > 
    <frameset cols="200,*" frameborder="1" border="0" framespacing="1" BorderColor="#7D9EC0"> 
    <frame src="left.jsp" name="left" scrolling="NO" noresize> 
    <frame src="index/default.jsp" name="right"> 
    </frameset> 
    </frameset> 
    在不同页面上写的框架:
    index.jsp页面 
    <frameset rows="70,*" cols="*" frameborder="1" border="0" framespacing="1" BorderColor="#7D9EC0"> 
    <frame src="top.jsp" name="top" scrolling="NO" noresize > 
    <frame src="down.jsp" name="down" scrolling="NO" noresize> 
    </frameset> 
    down.jsp <iframe frameBorder="0" id="left" name="left" src="left.jsp" 
    height="100%" width="162" > 
    </iframe> 
    <iframe frameBorder="0" id="main" name="right" scrolling="yes" 
    src="queryList.jsp" height="100%" width="100%" target="right"> </iframe> 
    或者 down.jsp 
    <frameset rows="90,*" cols="*" frameborder="1" border="0" framespacing="1" BorderColor="#7D9EC0"> 
    <frame src="goodsquery.jsp" name="up" scrolling="NO" noresize > 
    <frame src="queryList.jsp" name="down" noresize > 
    </frameset> 这样queryList.jsp这么跳出到登陆页面? 比如框架frameset中的iframe怎么跳出框架? 
      

  11.   

    主框架:index.php
    <frameset rows="19,*" cols="*" frameborder="no" border="0" framespacing="0">
      <frame src="UntitledFrame-6" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
      <frameset rows="*" cols="140,*" framespacing="0" frameborder="no" border="0" name="aa">
        <frame src="mf.php" name="leftFrame" scrolling="No" noresize="noresize" id="leftFrame" title="leftFrame" />
        <frame src="addbzs.php" name="mainFrame" id="mainFrame" title="mainFrame" />
      </frameset>
    </frameset>子框架:addbzs.php<frameset rows="183,*,197" cols="*" framespacing="0" frameborder="yes" border="0">
      <frame src="addbm.php" name="topFrame" scrolling="auto" noresize="noresize" id="topFrame" title="topFrame" />
      <frame src="zjbz1.php" name="mainFrame" scrolling="auto" id="mainFrame" title="mainFrame" />
      <frame src="zjbz.php" name="bottomFrame" scrolling="auto" noresize="noresize" id="bottomFrame" title="bottomFrame" />
    </frameset>下面的语句是放在zjbz1.php运行的,你看看了
    parent.parent.location.href = 'xxx.php'; 
      

  12.   

    这样测试能用吗? 我按照
     <frame src="addbzs.php" name="mainFrame" id="mainFrame" title="mainFrame" /> 
    <frame src="zjbz1.php" name="mainFrame" scrolling="auto" id="mainFrame" title="mainFrame" /> 
    关键是不是以上2句的 ID name要相同?
    zjbz1.php运行的
    parent.parent.location.href = 'xxx.php';
    我的代码还是指跳出第一层的框架, 还有哪里需要注意吗? 
      

  13.   

    不知道你的登陆页面是那个frame,如果只是这种嵌套的话,top就已经是最上层了。
    可以通过alert(top.location);alert(parent.parent.location);alert(top.id)之类来测试你想要的frame.
      

  14.   

    alert(top.id);
    alert(parent.parent.id);
    alert(parent.id);
    输出都是 undefined  晕
      

  15.   

    你没有ID,当然是undefined 
      

  16.   

    多谢各位 用top.location.href=""; 就可以了谢谢 我把页面搞错了session过滤应该写在将要跳转到得页面而不是本页面,晕啊 真的大家都很热心 结贴
      

  17.   

    <script language="javascript" type="text/javascript">
            if (top.location !== self.location) {
                top.location = self.location;
            }   
        </script>