English 中文(简体)
显示某些页面时,强制左侧(导航)栏固定。
原标题:
  • 时间:2009-01-20 15:28:37
  •  标签:

我有一个旧网站,在左侧有一个框架式导航,右侧则是页面。

当页面直接输入URL时,导航(左侧框架)也应该显示。

Until now I was an js working, but I don t know from when it are not working, now returns this message:

Forbidden You don t have permission to access /master.html on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 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 Server at www.cpis.es Port 80

我使用的代码是:

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> 

谢谢,Guillermo。

最佳回答

对不起,耽搁了。

看起来问题出在这个小的 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;
}

你必须在链接列表的每个页面中更改那个代码。我认为这应该解决问题。

问题回答

我刚才检查了网站,现在似乎可以使用了。我猜测服务器上没有位于http://www.cpis.es/master.html的文件。

如果问题仍然存在,请提供步骤,以便我们可以复现并查看出了什么问题。

感谢森麻衣库。

为了正确测试问题,请执行以下操作:

  • go to www.cpis.es
  • click the second option in the menu (CoPrint)
  • ok, you see the leftnav + the page

现在直接进入页面。

  • go to www.cpis.es/coprint.htm
  • error, you got the forbidden page.




相关问题
热门标签