// 获取地址栏参数,如果无值则为空字符串 // 日期:2020.12.23 // 用法:var id=GetQueryString("id"); // 获取地址栏参数,无值为空字符串 /* eslint-disable no-unused-vars */ function GetQueryString(name) { var search = window.location.search.substring(1) || window.location.hash.split('?')[1] || '' var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i') var res = search.match(reg) return res ? decodeURIComponent(res[2]) : '' }