[JS]js取html文件所带的参数值
[JS]js取html文件所带的参数值
[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>
热门文章推荐
- [JS]window.location获取url各项参数详解
- [JS]jQuery,javascript获得网页的高度和宽度
- [JS]视频弹窗视频弹出层videoLightBox(含三种播放器的用法)
- [JS]JS提交中文encodeURI两次转码
- [JS]js版方面encodeURI转码和decodeURI解码的用法实例
- [JS]js取当前机子的时间戳实例
- [JS]AES加密(基于crypto-js)PHP后端解密
- [JS]data:image/png;base64写法的用途及说明
请稍候...