参考1:http://www.w3school.com.cn/js/jsref_encodeURIComponent.asp
参考2:http://www.w3school.com.cn/js/jsref_decodeURIComponent.asp
实例:
var test1="http://www.w3school.com.cn/My first/"
document.write(encodeURIComponent(test1)+ "
")
document.write(decodeURIComponent(test1))
输出:
http%3A%2F%2Fwww.w3school.com.cn%2FMy%20first%2F
http://www.w3school.com.cn/My first/
JS对象转URL参数(原生JS和jQuery两种方式)
转自:点击打开链接 现在的js框架将ajax请求封装得非常简单,例如下面: $.ajax({ type: "POST", url: "some.php", da ...
js如何获取url参数
匹配URL参数的正则是: var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", ...
js获取当前url参数
//抓取url参数 function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theReque ...
JS页面跳转加密解密URL参数