日期:2014-05-19  浏览次数:20587 次

关于frame的跳转
我有一个页面,使用了frameset,定义了3个frame,同时页面使用了基于窗体的身份验证。
如果没有登录的话,页面会自动跳转到Login.aspx,现在的问题是,如果没有登录的话,3个frame都会跳转到Login.aspx,这样一个页面就出现了3个Login.aspx的页面,请问应该如何设置?

------解决方案--------------------
你可以使用打开一个页面,然后把当前页关闭的办法;
------解决方案--------------------
if(没有登录)
{
Response.Write( "top.window.location.href= 'login.aspx '; ");
}
------解决方案--------------------
document.frames[ 'mainFrame '].location= " "
------解决方案--------------------
打开的:
<Script language= 'JavaScript '>
var iWidth = 0;
var iHeight = 0;
iWidth=window.screen.availWidth-10;
iHeight=window.screen.availHeight-50;
var szFeatures = 'width= ' + iWidth + ',height= ' + iHeight + ',top=0,left=0,location=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,titlebar=no,toolbar=yes,directories=no ';
window.open( '你跳转的路径 ', ' ',szFeatures);
</Script>

关闭的:
<Script language= 'JavaScript '> window.parent.opener=null;window.parent.close(); </Script>
------解决方案--------------------
Response.Write( "top.window.location.href= 'login.aspx '; ");
------解决方案--------------------
1、loginUrl= "Redirect.html "

2、Redirect.html
...
<head>
<script language= "javascript ">
<!--
top.location.href = "Login.aspx ";
//-->
</script>
</head>
...
------解决方案--------------------
先关闭框架,再转跳
Response.Write( " <script> top.opener=null;window.top.close() </script> ");
Response.Write( " <script> window.open(\ "http://localhost/MBO/default.aspx\ ") </script> ");

或者如上:
Response.Write( "top.window.location.href= 'login.aspx '; ");

总之操作时要top