gpt4 book ai didi

javascript - 重新加载 DIV 后后退按钮不起作用

转载 作者:行者123 更新时间:2023-12-02 17:55:27 26 4
gpt4 key购买 nike

我目前正在网站上使用此代码,当您单击链接时,中央 Div 会刷新,从而节省一些带宽。该代码的工作方式就像一个魅力,唯一的问题是,当我单击后退按钮时,它会将我带出页面,因为浏览器仅注册对该站点的一次访问。有什么解决方法吗?JS:

<script type="text/javascript">
var ajaxdestination="";

function getdata(what,where) {
try {
xmlhttp = window.XMLHttpRequest?new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
}

document.getElementById(where).innerHTML ="<center><br><br><img id='loader' src='carga.png'></center>";
ajaxdestination=where;
xmlhttp.onreadystatechange = triggered;
xmlhttp.open("GET", what);
xmlhttp.send(null);
return false;
}

function triggered() {
if (xmlhttp.readyState == 4) if (xmlhttp.status == 200)
document.getElementById(ajaxdestination).innerHTML =xmlhttp.responseText;
}
</script>

我的链接如下所示:

<a class="active" href="javascript:void(0)" onclick="getdata('pag/identidad.php', 'container');">

编辑:我说的是浏览器的后退按钮:)

最佳答案

你的后退按钮在哪里..它在你的网站中或者是浏览器后退按钮。当你点击后退按钮时你想做什么,当你在浏览器中点击后退按钮时,它会让你从当前页面跳到最后一页访问过的页面。

关于javascript - 重新加载 DIV 后后退按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20987634/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com