1 获取浏览器中url中的参数,会自动把问号"?"去掉
1 function getParamsFromHref() { 2 //调试用 3 var wyl_ = window.location.search; 4 //去掉第一个字符,也就是去掉问号"?" 5 var parameters = window.location.search.substr(1); 6 var array = parameters.split('&'); 7 var object = new Object(); 8 for ( var i = 0; i < array.length; i++) { 9 var index = array[i].indexOf('='); 10 object[array[i].substring(0, index)] = array[i].substring(index + 1); 11 } 12 return object; 13 }