JS获取URL“#”后的值

http://localhost:62683/youli/product.htm#0 

alert(GetRequest());

//获取#号值
function GetRequest() {
  var str = location.href
  var num = str.indexOf("#");
  str = str.substr(num + 1);
  return str;
}

 

posted @ 2019-01-29 11:17  时光博客  阅读(4278)  评论(0编辑  收藏  举报