2012-09-05 164 views

回答

36

導航到另一個html頁面的代碼。

<!DOCTYPE HTML> 
<html> 
    <head> 
    <title>PhoneGap</title> 

      <script type="text/javascript" charset="utf-8" src="cordova-1.5.0.js"></script>  
      <script type="text/javascript" charset="utf-8"> 

      function onLoad() 
      { 
        document.addEventListener("deviceready", onDeviceReady, true); 
      } 

      function onDeviceReady() 
      { 
        // navigator.notification.alert("PhoneGap is working"); 
      } 

      function callAnothePage() 
      { 
       window.location = "test.html"; 
      } 

      </script> 

    </head> 

    <body onload="onLoad();"> 
     <h1>Welcome to PhoneGap</h1> 
     <h2>Edit assets/www/index.html</h2> 
     <button name="buttonClick" onclick="callAnothePage()">Click Me!</button> 
    </body> 

代碼回事件。

<script type="text/javascript" charset="utf-8"> 

      document.addEventListener("deviceready", onDeviceReady, true); 

      function onDeviceReady() 
      {  
        document.addEventListener("backbutton", BackKeyDown, true); 
      } 

      function BackKeyDown() 
      { 
       navigator.notification.alert(); 
       //navigator.app.exitApp(); // For Exit Application 
      } 
     </script> 
相關問題