为什么我不能从 second.html 导航到另一个内页 #page3 ?
我能够从 index.html 导航到 second.html。我的代码如下所示:
index.html 页面
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="widdiv=device-widdiv, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<title>
</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js">
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script>
$(document).on('pagebeforeshow', "#index",function () {
$(document).on('click', "#changePage",function () {
$.mobile.changePage('second.html', { dataUrl : "second.html?paremeter=123", data : { 'paremeter' : '123' }, reloadPage : false, changeHash : true });
});
});
</script>
</head>
<body>
<!-- Home -->
<div data-role="page" id="index">
<div data-role="header">
<h3>
First Page
</h3>
</div>
<div data-role="content">
<a data-role="button" id="changePage">Test</a>
</div> <!--content-->
</div><!--page-->
</body>
</html>
second.html 页面
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!-- Home -->
<div data-role="page" id="second">
<script type="text/javascript">
alert("Inside the Second Page");
$(document).on('pagebeforeshow', "#second",function () {
//$(document).ready(function(e) {
var parameters = $(this).data("url").split("?")[1];
parameter = parameters.replace("parameter=","");
alert(parameter);
});
function move(){
alert("moving...");
$.mobile.changePage('#third');
alert("moved !!!");
}
</script>
<div data-role="header">
<h3>
Second Page
</h3>
</div>
<div data-role="content">
<a href="#third" onClick="move()" data-role="button">Go to Property Page</a>
</div> <!--content-->
</div><!-- second page-->
<div data-role="page" id="third">
<script type="text/javascript">
alert("Inside Third Page...");
</script>
</div>!-- third page-->
</body>
</html>
在 second.html 页面中,还显示了第二条警报消息,但页面导航从未发生 ???。谁能让我知道我在这里缺少什么或者我在这里做错了什么?