當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
JS如何获取URL
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 閱讀(...) 評論(...) 編輯 收藏
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 閱讀(...) 評論(...) 編輯 收藏
轉載于:https://www.cnblogs.com/mbtq/archive/2012/10/23/2734949.html
總結
- 上一篇: 用VC创建程序启动画面
- 下一篇: 增强的Java FTP工具----扩展免