如何获取当前网址的定位锚值?
如何获取当前网址的定位锚值?
如,当前网址:http://www.xxx.com/xx.htm#test
如何通过javascript或其他手段得到定位锚值 test ???
------解决方案--------------------var url = 'http://www.xxx.com/xx.htm#test ';
alert(url.substr(url.indexOf( '# ') + 1));
------解决方案--------------------var h = document.location.hash;
if(h!= " ") h = h.substr(1,h.length-1);
alert(h);
------解决方案--------------------document.location.hash.subString(1)