HTML

          <div class="section">
  
  <div id="js-div">Database storage not functional</div>
</div>
<div class="section">
  <div class="summary">This test creates a database store (HTML5) and sets and retrieves data from this store.</div>
</div>
        

Javascript

            function store() {
  if (window.openDatabase) {
    var db = window.openDatabase("store", "", "Store App", 1024);
    var count=-1;
    document.getElementById("js-div").innerHTML="<i>Count = " + count + "</i>";
    db.transaction(function(tx) {
      tx.executeSql('CREATE TABLE IF NOT EXISTS Store (count INT)', []);
      tx.executeSql('SELECT count FROM Store', [], function(tx, rs) {
        if (rs.rows.length == 0) {
          count=0;
          tx.executeSql('INSERT INTO Store (count) VALUES (?)',[count]);
        } else {
          count=rs.rows.item(0).count;
          count++;        
          tx.executeSql('UPDATE Store SET count = ?',[count]);
        }
        document.getElementById("js-div").innerHTML="<i>Count from database store = " + count + "</i>";
      });
    });
  } else {
    document.getElementById("js-div").innerHTML="<i>Local Database APIs not available</i>";    
  }
}
window.onload = function() {
  store();
}

          
> Robot Bot or Crawler
This site is optimised for display on a mobile phone. For best results please visit with your phone @ http://test.bemoko.com
mobile ... made easy