标签:
代码:
$.extend({
getUrlVars: function () {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf(‘?‘) + 1).split(‘&‘);
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split(‘=‘);
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
},
getUrlVar: function (name) {
return $.getUrlVars()[name];
}
});
用法:
浏览器的url: http://域名/index.html?OrderCode=20151216173232283
获取OrderCode的值:
var result=$.getUrlVar("OrderCode")
标签:
原文地址:http://www.cnblogs.com/linJie1930906722/p/5210757.html