我正在尝试在我的数据库中获取 sessionStorage,但没有插入任何内容。
我的代码如下:
window.onload = function (){
doit.db = openDatabase('takenlijst V0.8', '1.0', 'takenlijst database', 2 * 1024 * 1024);
doit.db.transaction (function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS taak (ID INTEGER PRIMARY KEY , sID INTEGER, taak, datum, conditie);');
tx.executeSql('CREATE TABLE IF NOT EXISTS segment (ID INTEGER PRIMARY KEY , naam);');
});
document.getElementById("knopInvoeren").onclick = tInvoer;
};
var tInvoer = function (){
var datum = new Date();
var taak = document.getElementById("taakInvoer").value;
var conditie = 0;
var sID = sessionStorage.sMenuID;
doit.db.transaction(function (tx) {
alert(""+ sessionStorage.sMenuID +"");
tx.executeSql("INSERT INTO taak ("+sessionStorage.sMenuID+", taak, datum, conditie) VALUES (?, ?, ?, ?);", [sID, taak, datum, conditie]);
});
vulGegevens();
ophalen(sessionStorage.sMenuID);
};
当我提醒 sessionStorage 时,我得到了正确的值,但是当我尝试插入查询时,什么也没有发生。
有人知道我做错了什么吗?