js截取路径参数

(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);
var userId  = $.getUrlParam('userId');

//设备上物理像素和设备独立像素(device-independent pixels (dips))的比例
var device = window.devicePixelRatio;

相关文章:http://www.zhangxinxu.com/wordpress/?p=2568
posted @ 2017-06-28 15:11  lijun8637  阅读(793)  评论(0编辑  收藏  举报