js怎么连接数据库?

解决方案 »

  1.   

    <!DOCTYPE HTML>
    <html>
    <body>
    <!-- please use chrome or safari -->  
    <script>
    var db = openDatabase("databaseName",1.0,"alias",200000);
    db.transaction(function(tx){
    tx.executeSql("create table table1 (pid smallint not null unique,uid smallint not null, userName char,authorAvatar char, address char, createdAt int, updatedAt int, rating smallint ,certificationType smallint ,subject char ,text char, thumbnails char, type int)", [], function(tx,rss){alert("表创建成功")}, function(tx,err){alert(err.message)});
    });
    </script>
    </body>
    </html>