Handle #(hash) by JavaScript

HTML
<div style="height: 4000px"></div>
<span id='jump_to_this_location'>Jump here!</span>
<div style="height: 4000px"></div>
<span id='jump_to_the_end'>Jump here!</span>


Go to supposed place:
window.location.hash = "jump_to_this_location";

Get current URL and characters after #(hash):
var url = window.location.href;
var hash = url.substring(url.indexOf("#") + 1);
alert(hash);

Change current hash and go to that place:
window.location.hash = 'jump_to_the_end';