您好我有两个HTML文件index.html,然后在test.html中我已经重新添加按钮data-rel="back"
这两个文件,当我从指数去考,然后在test.html的,当我点击回按钮,那么它不会导航到index.html。我的索引文件是:后退按钮不工作的jQuery移动
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.1.0.css" />
<link rel="stylesheet" href="docs/assets/css/jqm-docs.css" />
<link rel="stylesheet" href="docsdemos-style-override.css" />
<script type="text/javascript" src="jquery.mobile/jquery-1.7.2.min"></script>
<script type="text/javascript" src="jquery.mobile/jquery.mobile-1.1.0.js"></script>
</head>
<body>
<div id="searchpage" data-role="page" data-theme="b" data-role="content" data-add-back-btn="true">
<div data-role="header" align="center">
<a href="#" data-rel="back" data-icon="arrow-l">Back</a>
<h1>index page</h1>
<a href="MainMenu.html" data-icon="grid">Menu</a>
</div>
<div data-role="fieldcontain" class="ui-field-contain ui-body ui-br" >
<input type="text" name="stock" id="enterstock" value="" />
<input type="submit" id = "verify" data-role="button">
</div>
<script type="text/javascript">
$("#verify").click(function (e)
{
e.stopImmediatePropagation();
e.preventDefault();
window.location = "Test.html";
//$.mobile.changePage('Test.html')
});
</script>
</div>
</body>
</html>
我的test.html是:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="jquery.mobile/jquery.mobile-1.1.0.css" />
<link rel="stylesheet" href="docs/assets/css/jqm-docs.css" />
<link rel="stylesheet" href="docsdemos-style-override.css" />
<script type="text/javascript" src="jquery.mobile/jquery-1.7.2.min"></script>
<script type="text/javascript" src="jquery.mobile/jquery.mobile-1.1.0.js"></script>
<!-- Uncomment following line to access PhoneGap APIs (not necessary to use PhoneGap to package web app) -->
<!-- <script type="text/javascript" charset="utf-8" src="cordova-1.6.1.js"></script>-->
</head>
<body>
<div id="cash" data-role="page" data-theme="a" data-role="content" data-add-back-btn="true">
<div data-role="header" align="center">
<a href="#" data-rel="back" data-icon="arrow-l">Back</a>
<h1>Test page</h1>
<a href="MainMenu.html" data-icon="grid">Menu</a>
</div>
<h1>Testing</h1>
</div>
</body>
</html>
如果我使用$.mobile.changePage('Test.html')
然后后退按钮工作正常,但与window.location = "Test.html";
它不工作。为什么这样?在blackberry5 changePage不工作,因此我不能使用它。任何建议将不胜感激。在此先感谢
感谢您的回复,其实我有很多页面,所以我不能将它们添加到相同的页面。任何其他解决方案导航到后面,而不使用ajax? – PPD 2012-07-24 06:09:25