PhoneGapのnavigatornotification.confirmの使い方の詳細
1556 ワード
navigator.notification.confirm(' ?', showConfirm, ' ', ' , ');
function showConfirm(button) {
if( button==1 ) {
document.removeEventListener("backbutton", eventBackButton, false);//
navigator.app.exitApp();// app
}
}
使用法:navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels]);
Message:ダイアログ情報.(文字列タイプ)confirmCallback:ボタンを押すとトリガーされるコールバック関数で、ボタンを押すインデックス(1、2または3)を返します.(関数タイプ)title:ダイアログボックスのタイトル.(文字列タイプ)(オプション、デフォルトは「Confirm」)buttonLabels:カンマで区切られたボタンラベル文字列.(文字列タイプ)(オプション、デフォルトは「OK、Cancel」)
上記のコードから分かるように、戻り関数受信ボタンの戻り値はbuttonでよい.
転載は以下のことを明記してください.http://www.tea119.com