关于浏览器地址的获取,多谢

关于浏览器地址的获取,在线等,谢谢比如地址是这样的http://localhost/file/index.html获取的地址是http://

关于浏览器地址的获取,在线等,谢谢
比如地址是这样的http://localhost/file/index.html
获取的地址是http://localhost/file/

http://community.csdn.net/Expert/PostNew.asp?room=304是这样的
获取的是http://community.csdn.net/Expert/

谢谢了

[解决办法]
function showurl()
{
var url=new String(top.location);
return url.substr(0,url.lastIndexOf( "/ ")+1);
}