2012年11月1日星期四

phonegap-notification

phonegap notification 的sample有点坑爹哇,与想象的有点差距其实就是个弹出对话框。 
如图: 
  1. <!DOCTYPE html>  
  2. <html>  
  3.   <head>  
  4.     <title>Notification Example</title>  
  5.   
  6.     <script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>  
  7.     <script type="text/javascript" charset="utf-8">  
  8.   
  9.     // Wait for Cordova to load  
  10.     //  
  11.     document.addEventListener("deviceready", onDeviceReady, false);  
  12.   
  13.     // Cordova is ready  
  14.     //  
  15.     function onDeviceReady() {  
  16.         // Empty  
  17.     }  
  18.   
  19.     // alert dialog dismissed  
  20.     function alertDismissed() {  
  21.         // do something  
  22.     }  
  23.   
  24.     // Show a custom alertDismissed  
  25.     //  
  26.     function showAlert() {  
  27.         navigator.notification.alert(  
  28.             'You are the winner!',  // message  
  29.             alertDismissed,         // callback  
  30.             'Game Over',            // title  
  31.             'Done'                  // buttonName  
  32.         );  
  33.     }  
  34.   
  35.     </script>  
  36.   </head>  
  37.   <body>  
  38.     <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>  
  39.   </body>  
  40. </html>  

没有评论:

发表评论