我有一个index.html
页面,我从index.html
页面调用了动态视图,然后点击导航到下一个视图。现在当我试图从下一个视图回到上一个视图时,我的后退按钮不起作用。我是phonegap的新手。以下是我的代码:
的index.html:
<a href="#" id="complaintsId" class="item-link close-panel item-content">
<div class="item-media">
<i class="fa fa-area-chart"></i>
</div>
<div class="item-inner" id="Div2">
<div class="item-title">Complaints</div>
</div>
</a>
的javascript:
var tableContent = '<div class="navbar"><div class="navbar-inner"> <div class="left"> </div>';
tableContent += ' <div class="center sliding"> </div><div class="right">';
tableContent += '<a href="#" class="link icon- only open-panel" data-panel="right"></a></div>';
tableContent += ' </div></div><div class="view another-view"><div class="pages">';
tableContent += '<div class="page no-toolbar" data-page="blog">';
tableContent += ' <div class="page-content"><div class="container-fluid"><div class="row">';
tableContent += '<div class="col-md-12 " id="DisableDiv1" style="width: 100%;"> #someText</a>';
tableContent += '</div></div></div></div> </div></div></div>';
function ComplaintsClick() {
$("#complaintsId").on('click', function () {
Surl = "***/api/Complaint/GetLeaderComplaint/***"";
var abcString = '';
$.ajax({
url: Surl,
type: 'GET',
data: '',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
success: function (data) {
$('#DisableDiv1').html("");
for (var i = 0; i < data.length; i++) {
abcString += ' <div class="col-md-12"><a href="#" class="btn" type="button" id="clicked_' + i + '" onClick="selectNews(' + data[i].complaintId + ')"> <h3> ' + data[i].title + ' </h3>';
abcString += ' <img alt="Bootstrap Image Preview" src="http://lorempixel.com/140/140/" />';
abcString += '<span class="commentDiscprition">' + data[i].comment + '</span> </a></div>';
}
$(".page-content").html('')
var abcx = tableContent.replace('#someText', abcString);
$(".page-content").html(abcx);
$("table#DisableDiv1 tr:odd").css("background-color", "#F4F4F8");
}
});
});
}
function selectNews() {
window.location = "ExpandNews.html";
}
我在这里尝试重定向到上一个视图:
ExpandNews.html
页面:
<div class="navbar">
<div class="navbar-inner">
<div class="left">
<a class="ui-link" href="#" rel="external" id="aa" onclick="onBackKeyDown()">
<img src="#" alt="Phone" border="0">
</a>
</div>
</div>
</div>
的javascript:
function onBackKeyDown() {
history.go(-1);
navigator.app.backHistory();
}