凌空路金海路:怎样让一个asp页面只能在框架<frame src="abc.asp">才能正常访问,其他直接输入地址提示错误信息。

来源:百度文库 编辑:神马品牌网 时间:2024/04/30 15:27:57
比如index.html的内容是
<frameset rows="*,30" style="border:0px">
<frame src="main.html" name="main" frameborder="0" id="main">
<frame src="ABC.asp" name="abc" frameborder="0" scrolling="no" noresize="noresize" id="abc">
</frameset>

其中框架ABC中ABC.asp只能在访问index.html时正常显示,其他在地址栏中直接输入ABD.asp则无法访问,请问该怎么写ABC.asp里的判断代码。
使用这样的方法ABD.asp里得不到ASP判断,查看源文件
仍然可以看到源代码。<script language=javascript>
if(top.location.href==self.location.href)self.location.href="index.html";
</script>

在ABC.asp里加
<script language=javascript>
if(top.location.href==self.location.href)self.location.href="index.html";
</script>