JS如何获取URL
一、
var url=document.location; url ="www.abc.com/sports/def.aspx"; var r =/\/(\w+)\.aspx/; alert(url.match(r)[1]); alert(r.exec(url)[1]);
二、
var url = document.location
url = " http://localhost:8080/Customer/index?token=ghfghfghfghfgh&mediaUserID=120122&redirect_url=www.wwwghgh.com";
var[] parm = url.Split('&');
var token = parm[0].Split('=')[1];
var userId = parm[1].Split('=')[1];
var Redirect = parm[2].Split('=')[1];
posted on 2012-10-23 09:57 mbtq 阅读(...) 评论(...) 编辑 收藏