2012-12-03 29 views
-1

的按鈕工作,我有JQM按鈕,它看起來像一個智能手機的按鈕,我從下面的網站上抄了一遍:navigator.app.exitApp()不JQM

http://appcropolis.com/how-to-make-iphone-back-button-in-jquery-mobile/

我加入到這一按鈕事件監聽退出應用程序(HTML5,Android的PhoneGap-)

function ButtonBack() { 
    // make sure we only add the point the back buttons 
    var backButton = $('a[data-theme="app-ios"]'); 
    backButton.find('.ui-icon').remove(); 
    backButton.append('<div class="ios-tip"><span>&nbsp;</span></div>'); 
     document.addEventListener(backButton, function() { 
      navigator.notification.confirm(
         'Do you want to quit', 
         onConfirmQuit, 
         'QUIT TITLE', 
         'OK,Cancel' 
        ); 
     }, true); 
    } 

} 

function onConfirmQuit(button) { 
    if (button == "1") { 
     navigator.app.exitApp(); 
    } 
} 

當您單擊該按鈕時,沒有任何反應,爲什麼? (沒有來函數onConfirmQuit)

+0

的[無法關閉HTML5應用程序(包裝上的PhoneGap)可能重複(http://stackoverflow.com/questions/13682454/can-not-close -html5-application-wrapped-on-phonegap) –

+0

你確定ButtonBack()運行嗎? –

+0

ButtonBack運行我測試它 –

回答