Javascript 显示某些页面时强制左(导航)帧
我有一个老网站,左边是框架导航,右边是页面 我想当一个网页是url的直接导航(左框)也显示 直到现在我还是一个js在工作,但我不知道从什么时候起它就不工作了, 现在返回此消息: 禁止的 您没有在此服务器上访问/master.html的权限。 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。 Apache/2.2.10(Unix)mod_ssl/2.2.10 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635服务器,位于www.cpis.es端口80 我使用的代码是Javascript 显示某些页面时强制左(导航)帧,javascript,html,iframe,Javascript,Html,Iframe,我有一个老网站,左边是框架导航,右边是页面 我想当一个网页是url的直接导航(左框)也显示 直到现在我还是一个js在工作,但我不知道从什么时候起它就不工作了, 现在返回此消息: 禁止的 您没有在此服务器上访问/master.html的权限。 此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。 Apache/2.2.10(Unix)mod_ssl/2.2.10 OpenSSL/0.9.8i DAV/2 mod_auth_passthrough/2.1 mod_b
http://www.webmasterworld.com/forum21/1205.htm
Call this javascript code from the HEAD section of each child page. The code creates a variable from the URL of the page, and then passes that variable in the new location's URL. This means a "master" frameset can load this exact page in the content section:
<SCRIPT LANGUAGE="JavaScript">
passpage = document.URL
if (top.location == self.location)
top.location.href="master.html?" + passpage
</script>
Then create just one "master.html" page. It holds the JavaScript code to decipher whatever URL is passed after the "?" and it writes that page into the content frame:
<html>
<head>
<title>Master Frameset</title>
</head>
<script language="JavaScript" type="text/javascript">
origURL = parent.document.URL
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length)
document.write('<frameset cols="20%,80%"><frame src="leftnav.html" name="nav"><frame src="' + contentURL + '" name="content"><\/frameset>')
</script>
</html>
http://www.webmasterworld.com/forum21/1205.htm
从每个子页面的HEAD部分调用此javascript代码。代码从页面的URL创建一个变量,然后将该变量传递到新位置的URL中。这意味着“主”框架集可以在内容部分加载此页面:
passpage=document.URL
if(top.location==self.location)
top.location.href=“master.html?”+密码
然后只创建一个“master.html”页面。它保存JavaScript代码以解密在“?”之后传递的任何URL,并将该页面写入内容框架:
主框架集
origURL=parent.document.URL
contentURL=origURL.substring(origURL.indexOf(“?”)+1,origURL.length)
文件。写入(“”)
谢谢你,吉列尔莫。我刚刚查看了网站,现在似乎正在运行。我的猜测是服务器上没有位于的文件 如果问题仍然存在,请提供步骤,以便我们重现问题并查看出了什么问题。谢谢Maiku Mori 为了正确测试问题,请执行下一步:
- 请访问www.cpis.es
- 单击菜单中的第二个选项(CoPrint)
- 好的,你看到左边的导航+页面
- 请访问www.cpis.es/coprint.htm
- 错误,你得到了禁止的页面
- 抱歉耽搁了
看起来问题出在javascript的这种小小的平静中:
passpage = document.URL
if (top.location == self.location)
top.location.href="master.html?" + passpage
应该是:
passpage = window.location.pathname;
if (top.location == self.location) {
top.location.href="master.html?" + passpage;
}
您必须更改链接列表中每个页面中的代码。我认为这应该能解决问题