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

相关文章:

  • 2021-12-09
  • 2021-11-23
  • 2021-12-12
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
猜你喜欢
  • 2021-08-03
  • 2022-01-10
  • 2022-12-23
  • 2021-12-20
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案