//获取网页的uid (function ($) { $.getUrlParam = function (name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } })(jQuery); console.log($.getUrlParam('id')); //id为浏览器地址栏?id=之后的字符