如何在phonegap中使用javascript返回上一页 测验申请 函数就绪(){ if(document.getElementById(“rb1”).已选中){ 警惕(“正确”); }else if(document.getElementById(“rb2”).已选中){ 警告(“不正确”); }否则{ 警告(“不正确”); } 函数prevpage(){ document.location=document.history.back(); } } 测验应用程序 JAVA是面向对象的语言吗? 是 否 可能是
上面是我的代码,用于重定向到第一个不起作用的页面。如何在phonegap中使用javascript返回上一页 测验申请 函数就绪(){ if(document.getElementById(“rb1”).已选中){ 警惕(“正确”); }else if(document.getElementById(“rb2”).已选中){ 警告(“不正确”); }否则{ 警告(“不正确”); } 函数prevpage(){ document.location=document.history.back(); } } 测验应用程序 JAVA是面向对象的语言吗? 是 否 可能是,javascript,html,cordova,phonegap-plugins,Javascript,Html,Cordova,Phonegap Plugins,上面是我的代码,用于重定向到第一个不起作用的页面。 请帮助我在第一页重定向。 我浏览了很多选项,比如window.location=-window.history.back(),window.history.back(1/-1),但它们都不工作。 提前感谢:)试试这个,它应该会有用的 <html> <head> <title>Quiz Application</title> <script type="text/javas
请帮助我在第一页重定向。
我浏览了很多选项,比如window.location=-window.history.back(),window.history.back(1/-1),但它们都不工作。
提前感谢:)试试这个,它应该会有用的
<html>
<head>
<title>Quiz Application</title>
<script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" charset="utf-8">
function ready() {
if (document.getElementById("rb1").checked) {
alert("correct");
} else if (document.getElementById("rb2").checked) {
alert("incorrect");
} else {
alert("incorrect");
}
function prevpage() {
document.location=document.history.back();
}
}
</script>
</head>
<body id="body2">
<form method="post">
<center><h1>Quiz Application</h1></center><br><br>
<center>Is JAVA Object Oriented Language ?<br><br>
<radiogroup>
<input type="radio" id="rb1"/>Yes<br>
<input type="radio" id="rb2"/>No<br>
<input type="radio" id="rb3"/>May Be<br>
<input type="submit" id="sub" value="Freeze" onclick="ready();"/><br>
<input type="submit" id="next" value="Previous Question" onclick="prevpage();"/></center>
</radiogroup>
</form>
</body>
</html>
}苏拉帕曼先生,不工作。它的文档不是网页,你正在使用哪个浏览器?我正在emulator上检查。它使用的是android phonegapcan,你可以将类型改为submit to button and check吗?我想你应该看到这个链接:它们是如何工作的?发生了什么事?控制台中有错误消息吗?另外,请删除所有与您的问题不直接相关的代码。请阅读。它给出了无法打开的错误文件。请将该信息以及错误消息的确切措辞添加到您的问题中。另外,您可能希望包含一些关于上一页是什么类型的文件的信息,因为它似乎是问题的根源。当previos页面是一个普通页面时,你应该检查它是否有效
function prevPage() {
history.go(-1);
navigator.app.backHistory();