我的手机应用程序有问题
所以这是我的HTML代码
<body>
<script>
window.onload = function() {
document.getElementById("a_next").onclick = function(e) {
e = e || window.event;
var els = document.getElementsByTagName("input"),
i;
for (i=0; i < els.length; i++) {
if (!els[i].checked) {
alert("Not all points on your checklist, are checked!");
return false;
}
}
};
};
</script>
<div id="topbar">
<div id="title">
Walk Around Check</div>
<div id="leftnav">
<a href="index_aerosoft.html">Home</a><a href="katana_checklist_all.html">Overview</a></div>
<div id="rightnav">
<a href="katan_checklist_beforeenginestarting.html"id="a_next">Next</a></div>
</div>
<div id="content">
<ul class="pageitem">
<li class="radiobutton"><span class="name">Electronic List - check all items</span>
<input name="1" type="radio" value="other" /></li>
</ul>
</div>
<div id="footer">
<!-- Support iWebKit by sending us traffic; please keep this footer on your page, consider it a thank you for my work :-) -->
<a class="noeffect" href="katana_checklist_walaroundcheck.html">Reset Checklist</a><br /><br />
<a class="noeffect" href="http://www.aerosoft.com">Aerosoft</a></div>
</body>
所以我想用手机提示添加或替换javascript警报
document.getElementById("a_next").onclick = function(e) {
e = e || window.event;
var els = document.getElementsByTagName("input"),
i;
for (i=0; i < els.length; i++) {
if (!els[i].checked) {
alert("Not all points on your checklist, are checked!");
return false;
}
}
};
所以我会在
<head>
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
}
</head>
让警报在javascript警报旁边显示
<body>
<script>
window.onload = function() {
document.getElementById("a_next").onclick = function(e) {
e = e || window.event;
var els = document.getElementsByTagName("input"),
i;
for (i=0; i < els.length; i++) {
if (!els[i].checked) {
alert("Not all points on your checklist, are checked!");
showAlert();
return false;
}
}
};
};
</script>
这不起作用并且让我的孔检查崩溃“所有人都检查过”任何人都可以帮忙吗?
答案 0 :(得分:0)
这里有效:
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// Empty
}
// alert dialog dismissed
function alertDismissed() {
// do something
}
// Show a custom alertDismissed
//
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
}
</script>
</head>
<body>
<p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
</body>
</html>
这里不起作用:
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.3.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// Empty
}
// alert dialog dismissed
function alertDismissed() {
// do something
}
// Show a custom alertDismissed
//
function showAlert() {
navigator.notification.alert(
'You are the winner!', // message
alertDismissed, // callback
'Game Over', // title
'Done' // buttonName
);
}
</script>
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="index,follow" name="robots" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="pics/iosIcon.png" rel="apple-touch-icon" />
<meta content="minimum-scale=1.0, width=device-width, maximum-scale=0.6667, user-scalable=no" name="viewport" />
<link href="css/style.css" rel="stylesheet" media="screen" type="text/css" />
<script src="javascript/functions.js" type="text/javascript"></script>
</head>
<body>
<p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
</body>
</html>
我的其他任何内容都可能会阻止警报?^^
更新
Oki我看到我是否排除了函数.js它的工作原理
var iWebkit;if(!iWebkit){iWebkit=window.onload=function(){function fullscreen(){var a=document.getElementsByTagName("a");for(var i=0;i<a.length;i++){if(a[i].className.match("noeffect")){}else{a[i].onclick=function(){window.location=this.getAttribute("href");return false}}}}function hideURLbar(){window.scrollTo(0,0.9)}iWebkit.init=function(){fullscreen();hideURLbar()};iWebkit.init()}}
答案 1 :(得分:0)
window.onload = function() {
document.getElementById("a_next").onclick = function() {
document.getElementsByTagName("input").each(function () {
if (!jQuery(this).checked) {
alert("Not all points on your checklist, are checked!");
showAlert();
return false;
}
});
};
};
Versuchs mal damit Nein der andere Code sollte da nichts blocken。