方法一//获取url参数function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return decodeURI(r[2]); return null; }var idCode = getQueryString(‘id‘);var title = getQueryString(‘title‘);$(".nav h3").text(title); 方法二
//获取url参数
var idArray = window.location.search.split("=");var id = idArray[1];
原文地址:https://www.cnblogs.com/chengyalin/p/10302611.html
时间: 2024-10-09 22:55:05