Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * 解析URL 查询字符串中的特定参数
- * @param key 想要获取的参数名称, 字符串
- * @param url 被解析的url字符串, 或者纯参数(?后面的部分)也可以.
- * @returns {undefined} 返回参数值, 如果url中没有这个key, 返回 undefined
- */
- var getParaByKey = function(key, url) {
- var reg = new RegExp("(\\?|\&)" + key + "=" + "(.*?)(\$|\&|\#)");
- return reg.exec(url) ? reg.exec(url)[2] : undefined;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement