1. 在同一页面中 [html] view plain copy print ? <a name="add"></a><!-- 定义锚点 --> <a href="#add">跳转到add</a> 2. 在不同页面中,锚点定位在a.html中,从另外一个页面的链接跳转到这个锚点 [html] view plain copy print ? <a href="a.html#add">跳转到a.add</a> 3. 点击链接触发js事件,同时跳转到锚点,有两种处理方式: 第一种: [html] view plain copy print ? <a href="#add" onclick="add()">触发add函数并跳转到add锚点</a> 第二种: [html] view plain copy print ? <div id="divNode"><!-- contents --></div><!-- 假设一个需要跳转到的节点 --> <a href="#" onclick="document.getElemetnById('divNode').scrollIntoView(true);return false;">通过scrollIntoView实现锚点效果</a>