title: openDatabase Hello World
body: <p>I'm trying to learn about openDatabase, and I think I'm getting it to INSERT INTO TABLE1, but I can't verify that the SELECT * FROM TABLE1 is working.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  google.load("jquery", "1");
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  var db;
  
  $(function(){
      db = openDatabase('HelloWorld');
  
      db.transaction(
          function(transaction) {
              transaction.executeSql(
                  'CREATE TABLE IF NOT EXISTS Table1 ' +
                  '  (TableID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, ' +
                  '   Field1 TEXT NOT NULL );'
              );
          }
      );
  
      db.transaction(
          function(transaction) {
              transaction.executeSql(
                  'SELECT * FROM Table1;',function (transaction, result) {
                      for (var i=0; i &lt; result.rows.length; i++) {
              alert('1');
                          $('body').append(result.rows.item(i));
                      }
                  }, 
                  errorHandler
              );
          }
      );
  
      $('form').submit(function() {
          var xxx = $('#xxx').val();
          db.transaction(
              function(transaction) {
                  transaction.executeSql(
                  'INSERT INTO Table1 (Field1) VALUES (?);', [xxx], function(){
                      alert('Saved!');
                  }, 
                  errorHandler
                  );
              }
          );
          return false;
      });
  });
  
  function errorHandler(transaction, error) {
      alert('Oops. Error was '+error.message+' (Code '+error.code+')');
      transaction.executeSql('INSERT INTO errors (code, message) VALUES (?, ?);', 
      [error.code, error.message]);
      return false;
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="post"&gt;
      &lt;input name="xxx" id="xxx" /&gt;
      &lt;p&gt;
      &lt;input type="submit" name="OK" /&gt;
      &lt;/p&gt;
      &lt;a href="http://www.google.com"&gt;Cancel&lt;/a&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>