url操作等

取得url ?及以前:

baseUrl = url.substr(0,url.indexOf('?')+1)
searchParam = searchParam.slice(0, -1);//去掉最后一位

$("ul.nav").on("click","li",function(e){
var href = "#"+$(this).attr("tag");
window.location.href = href;
})
window.location.href = "#2"//页面不刷新,替换hash
window.location.href = "?a=1"//页面刷新,替换search
原文地址:https://www.cnblogs.com/darr/p/4930435.html