You can add a return false;
, like this:
<a href="#" onclick="Register(); return false;">Register</a>
This prevents the default action of the anchor, which is to go to the hash, causing the scroll.
Use:
<a href="javascript:void(0);" onclick="Register(); ">Register</a>
javascript:void(0) will prevent the page from getting redirected and also will fix the issue where your page is getting scrolled on top due to href="#"