<html>
<body>
<h1>Anchor 对象</h1>
<h2>hash 属性</h2>
<p><a id="myAnchor" href="http://www.example.com:80/test.htm#part2">示例链接</a></p>
<p>上面链接的锚部分是:</p>
<p id="demo"></p>
<script>
let text = document.getElementById("myAnchor").hash;
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>