锚点

1,在页面添加location.hash可实现无论哪个页面跳到该页面都跳到固定位置。
<script language="javascript">
location.hash="#navBar";
</script>
<html>
<head>
</head>
<body>
<div id="navBar">
</div>
</body>
</html>
2,如果是点击跳转到本页某位置,<a href="#锚点id"></a>
3,如果是点击跳转到其它页某位置,<a href="lindex.html#锚点id"></a>

原文地址:https://www.cnblogs.com/qianyouluo/p/4761041.html