title: How to Run the HTML file with JavaScript in Web Browser and XCode?
body: <p>I want to create iPhone app using phonegap Cordova 2.0. Now <code>i wrote Javascript external and HTML code</code>. Then i have put the <code>JavaScript code into the HTML5 file</code>. Now i want to run the HTML file on the web browser. When i run the HTML in the Browser the Javascript is not working. The browser shows whatever in the HTML . So could you please help me to <code>run the HTML5 file with JavaScript on the browser and in XCode Phonegap</code>.</p>
  
  <p>This below coding is JavaScript coding.</p>
  
  <pre><code>    
  
  var bodyLoaded = function()
   {
      document.addEventListener("deviceready", onDeviceReady, false);
   }
  
      // Cordova is ready
      //
      function onDeviceReady() {
          var options = new ContactFindOptions();
          options.filter="";
          filter = ["displayName","organizations"];
          navigator.contacts.find(filter, onSuccess, onError, options);
      }
  
      // onSuccess: Get a snapshot of the current contacts
      //
      function onSuccess(contacts) {
          for (var i=0; i&lt;contacts.length; i++) {
              for (var j=0; j&lt;contacts[i].organizations.length; j++) {
                  alert("Pref: " + contacts[i].organizations[j].pref + "\n" +
                          "Type: " + contacts[i].organizations[j].type + "\n" +
                          "Name: " + contacts[i].organizations[j].name + "\n" + 
                          "Department: "  + contacts[i].organizations[j].department + "\n" + 
                          "Title: "  + contacts[i].organizations[j].title);
              }
          }
      };
  
      // onError: Failed to get the contacts
      //
      function onError(contactError) {
          alert('onError!');
      }
  </code></pre>
  
  <p>Below coding is located in my HTML5  </p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
   &lt;meta charset="utf-8" /&gt; 
  
      &lt;title&gt;Contact Example&lt;/title&gt;
      &lt;script type="text/javascript" charset="utf-8" src="Contectscript.js"&gt;&lt;/script&gt;
     
    &lt;/head&gt;
    &lt;body&gt;
      &lt;body onload='alert(1);'&gt;
      &lt;body onload='bodyLoaded();'&gt;
      &lt;h1&gt;Example&lt;/h1&gt;
      &lt;p&gt;Find Contacts&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>