一、//JQ獲取URL中是否含有某個字符的話,對頁面進行某種操作
例:如果URL中含有xia的字符,就在頁面引入一個css
var str=window.location.href; //獲取地址欄URL if(str.indexOf("xia")>-1){ //如果URL中含有xia就對頁面進行某種操作 $("head").append("<link>"); var toolbarCss = $("head").children(":last"); toolbarCss.attr({ rel: "stylesheet", type: "text/css", href: "http://html.huiyiguanjia.com/custom/201803FuneralInterment/css/index-fsy.css" }); }