获取元素 绑定事件
<script type="text/javascript">
window.onload=function(){
btn=document.getElementById("btn");
btn.onclick=function(){
location.hash="#top";
}
}
</script>
<body>
<div style="height: 500px;background: #f00" id="top"></div>
<div style="height: 500px;"></div>
<input type="button" id="btn" value="返回顶部">
</body>