封装GetQueryString()方法来获取URL的value值

mac2022-06-30  109

扫二维码进入页面,截取url“?”后面的value,url为.../monitorScreen/category.html?ridgeCode=ZT1S010005

function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var url = window.location.search; var r = url.substr(1).match(reg); if(r != null) return unescape(r[2]); return null; } var code = getQueryString('ridgeCode');

打印code则为ZT1S010005

转载于:https://www.cnblogs.com/eyed/p/11390268.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)