[英]use javascript,php, or html to reload a page when the URL changes
I am trying to get a page that when the URL changes it immediately reloads and uses the parameters in the URL.我试图获得一个页面,当 URL 更改时,它会立即重新加载并使用 URL 中的参数。 The first url is:
http://localhost/victorphp/Callvisor/bp/index.php
第一个url是:
http://localhost/victorphp/Callvisor/bp/index.php
This does not work for some reason:由于某种原因,这不起作用:
<a href="http://localhost/victorphp/Callvisor/bp/index.php?section=user&Mpage=tools" onClick="window.location.reload" >
Test
</a>
When I click on the link the page reloads without the parameters.当我单击链接时,页面会重新加载而没有参数。
Try to add id to your link尝试将 id 添加到您的链接
<a href="http://localhost/victorphp/Callvisor/bp/index.php?section=user&Mpage=tools" id="1" onClick="loadUrl(this)" >
Test
</a>
Create function loadUrl() in your js file在你的 js 文件中创建 function loadUrl()
function loadUrl(lid){
var url=document.getElementById(lid.id).href;
location.href=url;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.