js获取当前路径的url

来源:互联网 发布:mac怎么打出顿号 编辑:程序博客网 时间:2024/04/30 08:12
//获取当前窗口的Url  //returnUrl=http://localhost:8080/shopping/buyCart.shtml?skuId=510&amount=1window.location.href    //获取当前窗口的主机名 例如:http://localhost:8080     window.location.host//获取当前窗口的端口  例如: 8080window.location.port//获取当前窗口的路径 例如: /shopping/buyCart.shtmlwindow.location.pathname//获取当前文档的Urldocument.URL//获取参数  例如: ?skuId=510&amount=1window.location.search//跳出当前窗口,打开新窗口window.open(url);

0 0
原创粉丝点击