var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
 var msg;
 db.transaction(function (tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
    tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, "foobar")');
    tx.executeSql('INSERT INTO LOGS (id, log) VALUES (2, "logmsg")');
    msg = '<p>Log message created and row inserted.</p>';
  console.log(msg);
 });
 db.transaction(function (tx) {
    tx.executeSql('SELECT * FROM LOGS', [], function (tx, results) {
    var len = results.rows.length, i;
     msg = "<p>Found rows: " + len + "</p>";
     console.log(msg);
    for (i = 0; i < len; i++){
       msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
       console.log(msg);
     }
 }, null);});

html5_websql的更多相关文章

随机推荐

  1. socket服务器

    Python 3.x,已经改名为socketserver:Python 2. #coding=utf-8 #1.必须自己创建一个请求处理类,并且这个类要继承BaseRequesHandler,并且还要 ...

  2. nginx负载均衡的搭建和简单例子

    一,nginx 下载地址:http://nginx.org/en/download.html 二,下载对应版本 三,打开下载的安装包:如下图 四,运行nginx.exe 1,这个是时候,程序运行都是一 ...

  3. Vue-cli2项目文件目录解析

    前言 不是原创,真的不是原创,主要我是根据CSDN的一篇文章和其他平台上的文章整理而来,在最后我会贴上所有原文的地址,下面正式进入正文. Vue-cli项目文件目录结构 这个是Vue-cli2.0版本 ...

  4. JavaScript——call() 方法

    function Product(name, price) { this.name = name; this.price = price; } function Food(name, price) { ...

  5. Sublime Text插件安装方法和常用插件

    插件安装方法: 1.打开Sublime Text,按下Ctrl+Shift+P调出命令面板 ; 2.输入install 调出 Install Package Control选项并回车; 3.再次按下C ...

  6. MiniUI学习笔记1-新手必读

    1.mini的全局方法 2.Ajax jQuery 拥有完整的 Ajax 兼容套件.其中的函数和方法允许我们在不刷新浏览器的情况下从服务器加载数据. 详细jQuery Ajax教程,可参考这里. 3. ...

  7. select 项目<选课系统>

    """1. 创建北京.上海 2 所学校 学校类对象 属性:名字,地址 行为: 2. 创建linux , python , go 3个课程 , linux\py 在北京开, ...

  8. Java基础学习(3)

    Java基础学习(三) Java异常 Throwable类:所有异常的祖先类 Error:虚拟机异常.内存错误.没法处理 Exception:编码.环境.用户操作输入出现问题 非检查异常(自动捕获): ...

  9. Taro -- 定义全局变量

    Taro定义全局变量 方法1:在taro中 getApp()只能取到一开始定义的值,并不能取到改变后的值 // app.js文件中 class App extends Component { cons ...

  10. Tunnel connection failed: 407 Proxy Authentication Required

    报错信息 : Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connecti ...