<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Notifications</title>
<script type="text/javascript" charset="UTF-8" src="cordova.js"></script>
<script type="text/javascript" charset="UTF-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
checkConnection();
}
//顯示自定義的警告
function showAlert(){
navigator.notification.alert('Game Over!',alertCallback,'Game Over!','Done');
}
//警告的回調(diào)
function alertCallback(){
}
//顯示一個(gè)自定義的確認(rèn)對(duì)話框
function showConfirm(){
navigator.notification.confirm('Game Over!',onConfirm,'Game Over!','Restart,Exit');
}
//確認(rèn)對(duì)話框的回調(diào)
function onConfirm(button){
alert('You selected button '+button);
}
//鳴叫兩次
function playBeep(){
navigator.notification.beep(2);
}
//振動(dòng)
function vibrate(){
navigator.notification.vibrate(4000);
}
</script>
</head>
<body onload="onLoad()">
<p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
<p><a href="#" onclick="showConfirm(); return false;">Show Confirmation</a></p>
<p><a href="#" onclick="playBeep() return false;">Play Beep</a></p>
<p><a href="#" onclick="vibrate() return false;">Vibrate</a></p>
</body>
</html>
以上這篇使用phonegap進(jìn)行提示操作的具體方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。