JS獲取URL中最後一個斜槓前面的內容
var url = window.location.href;
var index = url.lastIndexOf("\/");
str = url.substring(0,index+1);
console.log(str); // http://www.mywlaq.cn/archives/
JS獲取URL中最後一個斜槓後面的內容
var url = window.location.href;
var index = url.lastIndexOf("\/");
str = url.substring(index + 1,url.length); console.log(str); // 3390.html