JS获取URL“#”后的值

2022-05-06 14:03:09 浏览数 (1)

代码语言:javascript复制
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;
}
url

0 人点赞