【发布时间】:2015-01-06 06:39:56
【问题描述】:
考虑以下 sn-p:
<div id="help"></div>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script>
var loadPage = function (){
$("#help").load("http://localhost:3000/manual.html");
}
onload=loadPage;
</script>
这存在于我的主页上:
http://localhost:3000/
上面的代码可以正常工作并加载我的手册页。但是,如果我在 manual.html 中单击这样的链接:
<a href='#introduction'>Introduction</a>
然后帮助 div 中的页面跳转到#introduction 部分,但是我的浏览器中的 url 更新为:
http://localhost:3000/#introduction
这是没有意义的,因为#introduction锚点只存在于manual.html中,如何防止#help div中的链接影响浏览器中的地址栏?
【问题讨论】:
标签: javascript jquery html