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