PhoneGap-----event in the Code

来源:互联网 发布:软件需求分析工具 编辑:程序博客网 时间:2024/05/16 03:19
<!DOCTYPE html><html><head><title>PhoneGap Event Example</title><script type="text/javascript" charset="utf-8" src="cordova.js"></script><script type="text/javascript" charset="utf-8">   document.addEventListener("deviceready",onDeviceReady,false);      function onDeviceReady(){   //To detect when the device is ready, use the  deviceready event.   document.addEventListener("pause",onPause,false);   document.addEventListener("resume",onResume,false);   document.addEventListener("backbutton",onBackButton,false);   document.addEventListener("menubutton",onMenuButton,false);   document.addEventListener("searchbutton",onSearchButton,false);   document.addEventListener("online",isOnline,false);   document.addEventListener("offline",isOffline,false);   }      function onPause(){   //To detect when the application has been paused, use the  pause event.   }      function onResume(){   //To detect when the application has been resumed, use the resume event.   }      function onBackButton()   {   //To detect when the Back button has been pressed on an Android device,use the backbutton event.   alert("onBackButton!");   }      function onMenuButton(){   //To detect when the Menu button has been pressed on an Android device,use the menubutton event.   alert("onMenuButton");   }      function onSearchButton(){   //To detect when the Search button has been pressed on an Android device, use the searchbutton event.   }      function isOnline(){   //To detect when the application is online (connected to the Internet), use the online event.   }      function isOffline(){   //To detect when the application is ol  ine (not connected to the Internet),use the offline event.   }   </script></head><body>  <h1>PhoneGap Event Example</h1></body></html>