save.onclick=function(){
for (var i = 1; i < tb.getElementsByTagName('tr').length; i++) {
var tds=tb.getElementsByTagName('tr')[i].getElementsByTagName('td');
database.transaction(function(fx){
fx.executeSql(
"insert into class (id,name,age,sex)values(?,?,?,?)",
[tds[0].innerHTML,tds[1].innerHTML,tds[2].innerHTML,tds[3].innerHTML],
function(){
alert("insert success!!!");
},
function(){
alert("insert false!!!");
}
)
})
}
}
save.onclick = function () {
for (var i = 1; i < tb.getElementsByTagName('tr').length; i++) {
var tds = tb.getElementsByTagName('tr')[i].getElementsByTagName('td');
database.transaction(
(function () {
return function (fx) {
fx.executeSql(
"insert into class (id,name,age,sex)values(?,?,?,?)",
[tds[0].innerHTML, tds[1].innerHTML, tds[2].innerHTML, tds[3].innerHTML],
function () {
alert("insert success!!!");
},
function () {
alert("insert false!!!");
}
)
}
})(tds)
);
}
}