凤凰台上凤凰游,凤去台空江自流。吴宫花草埋幽径,晋代衣冠成古丘。三山半落青天外,二水中分白鹭洲。总为浮云能蔽日,长安不见使人愁。

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

posted @ 2013-06-21 11:14  天兵Q  阅读(5405)  评论(0编辑  收藏  举报