标签:
function getParam(key) { var tmp = location.search; tmp = decodeURIComponent(tmp); var index = tmp.indexOf(key); var length = key.length; var value; if(index != -1){ var start = index+length+1; var end = tmp.indexOf(‘&‘,start); if(end == -1){ value = tmp.slice(start); } else{ value = tmp.slice(start,end); } } else{ value = ‘‘; } return value; } console.log( getParam(‘userid‘) ); // xxx
标签:
原文地址:http://www.cnblogs.com/isdom/p/webclips054.html