您现在的位置是:首页 > 电脑技术查询 > web开发

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

编辑:chaxungu时间:2022-10-02 23:22:29分类:web开发

关于浏览器地址的获取,在线等,谢谢
比如地址是这样的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);
}