[英]Having a navigation bar onclick/href execute animation on a circle element then loading a new page - How?
[英]How to show real url on the navigation bar when using <a href=“#” onclick=“funtion('test.php')”>
我尝试使用javascript打开内容页面。 所以,我不必编写所有页眉和页脚页面。 但是,有一个问题,导航栏中没有显示网址。 反正有没有让真实的网址出现在导航栏中? http://www.page.com/test.php ?
<script> function openLink(url) { $( ".contentTable" ).load(url); } </script>
<a id="link1" href="#" onclick="openLink('test.php')">Link</a>
您似乎需要使用浏览器的历史记录api:
https://developer.mozilla.org/en-US/docs/Web/API/History_API#The_pushState()_method
一个例子 :
history.pushState({}, "New page test", "/test.php");
第一个参数是一个状态,第二个是标题,第三个是你的网址。
pushState会将条目添加到您的历史记录中,而replaceState将用新的状态替换您当前的历史记录状态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.