主题:关于隐藏网页文件的文件名问题
目的:比如有个网站域名为www.abc.com.cn,为了隐含本站内所有文件名,比如客户浏览的是http://www.abc.com.cn/abc/abc.asp,则地址栏只显示:http://abc.com.cn/abc/,如果浏览的是Http://www.abc.com.cn/default.asp,则只显示:Http://www.abc.com.cn/
以下是我的代码,还差一步就是如何让得到的字符串c(下面代码中的一个变量)显示在地址栏里呢?请高手指点。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<script language='javascript'>
var a;
a=window.location.href;
function getSiteBase(sUrl)
{
var s=sUrl;
return s.substr(0,s.lastIndexOf('/'));
}
</script>
</head>
<body>
test<br>
<script language='javascript'>
var b,c;
b=getSiteBase(a);
document.write(a);
document.write("<br>");
document.write(b);
document.write("<br>");
c=b+'/';
document.write(c);
window.location.href=c;
</script>
</body>
</html>
如果用window.location.href=c的话,则跑到那个目录下去了