如何将值从 javascript var 传递给 executeSql?
我写了这段代码:
function BuscaRegistros() {
var mydata=document.getElementById("lugar").value;
var mydata2=document.getElementById("fecha").value;
var db = openDatabase('sightings03', '1.0', 'Test DB', 2 * 1024 * 1024);
db.transaction(function (tx) {
tx.executeSql('SELECT CommonName FROM Sights03 WHERE location=**"mydata"** AND datte="**mydata2**"' , [], function (tx, results) {
var len = results.rows.length, i;
for (i = 0; i < len; i++){
document.despliega.desp.options[i]=new Option(results.rows.item(i).CommonName,i);
}
}, null);
});
}