2016-10-13 00:16:48 点击量:90 标签: 收藏本文
[JS]js取html文件所带的参数值
- <a href=3.html?qq=1&ww=2&aa=3>测试</a>
- <script>
- function chk()
- {
- if(location.search=="")
- {
- return false
- }
- var s=location.search
- alert(s.substr(1,s.length).split("&")[0]);
- alert(s.substr(1,s.length));
- }
- //window.onload=chk
- </script>
- <script>
- function GetRequest()
- {
- var url = location.search; //获取url中"?"符后的字串
- var theRequest = new Object();
- if(url.indexOf("?") != -1)
- {
- var str = url.substr(1);
- strstrs = str.split("&");
- for(var i = 0; i < strs.length; i ++)
- {
- theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
- }
- }
- return theRequest;
- }
- </script>
- <script>
- var Request=new Object();
- Request=GetRequest();
- var i,o,p;
- i=Request['qq'];
- o=Request['ww'];
- p=Request['aa'];
- //alert(i);
- //alert(o);
- alert(p);
- </script>
我们是一家提供综合软件外包与弱电工程服务的技术公司。
业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。
公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室