js 获取当前的网址


http://www.xcx.cc/index.php/home/index/ind?idf=12321
var $cur_url=window.location.href; //获取全部的网址
var $psurl = window.location.pathname; // 获取 index.php/home/index/ind
var $par = window.location.search; //获得 ?idf=12333
var test = window.location.host; // www.xcx.cc
if($par.length>0){
$psurl=$psurl+$par
}
alert($psurl);
posted @ 2017-06-23 10:49  对方屌丝正在输入中  阅读(287)  评论(0编辑  收藏  举报