简体   繁体   English

使用 javascript、php 或 html 在 ZE6B391A8D2C4D45902A23A8B 更改时重新加载页面

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM