Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用<;时如何在导航栏上显示真实url;a href="#&引用;onclick=";函数(';test.php';)”&燃气轮机;_Javascript_Html_Onclick - Fatal编程技术网

Javascript 使用<;时如何在导航栏上显示真实url;a href="#&引用;onclick=";函数(';test.php';)”&燃气轮机;

Javascript 使用<;时如何在导航栏上显示真实url;a href="#&引用;onclick=";函数(';test.php';)”&燃气轮机;,javascript,html,onclick,Javascript,Html,Onclick,我试图用javascript打开内容页。所以,我不必写所有的页眉和页脚。但是,有一个问题,url没有显示在导航栏中。是否有任何方法可以使真正的url显示在导航栏中 函数openLink(url){ $(“.contentTable”).load(url); } 您似乎需要使用浏览器的历史api: 例如: history.pushState({}, "New page test", "/test.php"); 第一个参数是状态,第二个参数是标题,第三个参数是url pushState会将

我试图用javascript打开内容页。所以,我不必写所有的页眉和页脚。但是,有一个问题,url没有显示在导航栏中。是否有任何方法可以使真正的url显示在导航栏中


函数openLink(url){
$(“.contentTable”).load(url);
}

您似乎需要使用浏览器的历史api:

例如:

history.pushState({}, "New page test", "/test.php");
第一个参数是状态,第二个参数是标题,第三个参数是url


pushState会将条目添加到您的历史记录中,replaceState会将当前历史记录状态替换为新的历史记录状态。

您似乎需要使用浏览器的历史记录api:

例如:

history.pushState({}, "New page test", "/test.php");
第一个参数是状态,第二个参数是标题,第三个参数是url

pushState会将条目添加到您的历史记录中,replaceState会将您当前的历史记录状态替换为新的历史记录状态