gpt4 book ai didi

javascript - 添加 data-ajax ="false"后退按钮不起作用

转载 作者:行者123 更新时间:2023-11-28 02:43:14 25 4
gpt4 key购买 nike

嗨,我假设有两个 html 文件:index.html 和 test.html。在index.html 中,我有一个按钮,单击该按钮后我将其称为test.html。在 test.html 中我显示一个表格。现在我的index.html是这样的:

<div data-role="page" id="home" data-theme="d">

<div data-role="header" align="center">

<a href="#" data-rel="back" data-icon="arrow-l">Back</a>
<h1>MySite.com</h1>
<a href="MainMenu.html" data-icon="grid">Menu</a>


</div>
<div data-role="content" >

<a href="UI/Equal/test.html" data-ajax="false" data-role="button" id="myButton">i ndex</a>



<ul data-role="listview" data-inset="true">
<li><a href="UI/Equal/test.html" data-ajax="false"> Order Book </a></li>
</ul>

</div>
</div>

现在,单击按钮并在列表上转到 test.html,并且表格显示正确。在我的 test.html 中有一个标题,其中我有后退按钮:

<div data-role="header" align="center">

<a href="#" data-rel="back" data-icon="arrow-l">Back</a>
<h1>Test.com</h1>
<a href="MainMenu.html" data-icon="grid">Menu</a>


</div>

现在,当我单击后退按钮时,它不会转到index.html。如果我从 index.html 中删除 data-ajax="false" ,则 test.html 的后退按钮可以正常工作,但现在在 test.html 中,我在表中使用 .css 文件,现在效果如下该 .css 文件的内容未应用。如果我在index.html中使用data-ajax="false",那么在Test.html表上正确绘制(意味着我的.css文件正确加载)。我如何同时获得正确的后退按钮和表格。

任何建议将不胜感激。提前致谢。

最佳答案

当您使用data-jax="false"时您正在禁用 jquery mobile 的 Ajax 导航,因此您链接到的页面无法访问 DOM 中的上一页。

要在第二页上显示后退按钮,您需要使用传统的 <a href="..." 将其硬编码到页眉中。链接,或者对其进行编码以从 DOM 中提取上一页。

关于javascript - 添加 data-ajax ="false"后退按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12337141/

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