PhoneGap中navigator.notification.confirm的用法詳解


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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM