我有一個問題,後退按鈕上的科爾多瓦事件沒有執行任何警告(「」)。科爾多瓦的後扣不起作用
有趣的是,代碼看起來很完美,我甚至沒有忘記引入cordova.js
我唯一能想到的就是有必要洗一個插件,因爲我沒有任何建立。
我的代碼看起來像這樣:
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height" />
<link rel="stylesheet" href="css/phonon.css" />
<style>
.uvitani {
font-size: 250%;
margin: 0;
color: white;
position: absolute;
top: 40%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%)
}
.tlacitko {
margin: 0;
color: #0084e7;
background-color: white;
position: absolute;
bottom: 0;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%)
}
</style>
</head>
<script type="text/javascript" charset="utf-8">
function barva() {
alert(cordova.platformId);
if (cordova.platformId == 'android') {
StatusBar.backgroundColorByHexString("#0065b3");
}
document.addEventListener("backbutton", onBackKeyDown, false);
function onBackKeyDown() {
alert("Back");
}
}
</script>
<body style="background-color: #0084e7;" onload="barva();">
<center>
<p class="uvitani">Vítejte v aplikaci ISAS</p>
<button class="btn tlacitko" onclick='document.location="styl.html";'>Pokračovat</button>
</center>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script src="js/phonon-core.js"></script>
<script src="js/components/forms.js"></script>
<script src="js/components/preloaders.js"></script>
<script src="js/components/dialogs.js"></script>
</body>
</html>
將錯誤添加到您的問題 – Zoe
請在alert(「back」)中傳遞一些字符。 –
警報未啓動 – Lukas0025