请问如何保持页面带着框架页?
一个框架页面有3个页面,上面的框架页面时A页,左框架为B页,右框架为C页,如果我单独访问C页,如何是页面显示是带着框架的页面?
------解决方案--------------------访问C时,要带什么样的框架?
------解决方案--------------------try
{
var a=typeof(左框架的名称);
if( "object "!=a) 没找到左框架,有问题了
}
catch(e) {}
------解决方案--------------------是不是这个意思:当访问无框架页面C的时候,让它转到有框架的页面(C被包含的页面)?
可以在C页面里这样写
if(window.parent!=window){
window.location.href = '*** ' ;//这里***是原始页面
}
------解决方案--------------------if(this.parent=this.self)//语法不太记得了
window.location.href= 'frame.htm '
------解决方案--------------------c中
if(window.top.location.toString().toLowerCase().indexOf( "a.asp ") == -1)
{
window.location.href= "a.asp
}
------解决方案-------------------- <script language= "javascript ">
<!--
if (window == top)top.location.href = "XXXX ";
// -->
</script>
------解决方案--------------------c 中这样写
<script>
if(top.location==self.location)
{
top.location= "index.htm? "+self.location;
}
</script>
index.htm 中这样写
<script>
document.write( ' <iframe id= "mid " name= "mid " width= "100% " height= "100% " frameborder= "0 " scrolling= "auto " ')
var n=self.location.href.indexOf( "? ")//查看是否包含参数
if(n> 0)//存在参数
{
//指向参数
document.write( " src= "+self.location.href.substr(n+1))
}
document.write( '> </iframe> ')
</script>
------解决方案-------------------- <script language= "JavaScript "> <!--
if (window == top)top.location.href = "frames.htm "; //frames.htm为框架网页
// --> </script>
------解决方案--------------------学习
------解决方案--------------------这个似乎用response.redirect就可以实现,你要求的只是页面转向而已,与框架无关
------解决方案--------------------看看这个http://club.chinaren.com/94750880.html
下边的代码起的作用
<script language= "javascript ">
var msgId = "http://club.chinaren.com/94750880.html ";
msgId = msgId.substring(msgId.lastIndexOf( "/ ")+1,msgId.lastIndexOf( ". "));
function redirect(){
var refer = document.referrer;
refer = refer?refer: " ";
if(window.top.location == window.location && refer.indexOf( ".chinaren.com ") < 0){
window.top.location = "http://club.chinaren.com/bbs/index.jsp?boardid=18&hotmsgid= "+msgId;
}
}
redirect();
</script>