See website: groups.google.com/forum/?fromgroups#!topic/phonegap/YCRt2HducKg
function loadUniteSelectListe() { db.transaction(function (tx) { //populate drop down for unites tx.executeSql('SELECT * FROM Unites', [], function (tx, results) { var len = results.rows.length; var i=0; var txt=""; for (i = 0; i < len; i++){ txt=txt + "<option value="+results.rows.item(i).uniteName + ">" + results.rows.item(i).uniteSymbol + "</option>"; } document.getElementById("filtreUniteSelect").innerHTML=txt; }, null); });
}
Related to the following HTML:
Unité: <select name="filtreUniteSelect" id="filtreUniteSelect" ></select><br/>
with table: Combines
CREATE TABLE IF NOT EXISTS Unites (uniteID INTEGER PRIMARY KEY AUTOINCREMENT, uniteName TEXT, uniteSymbol TEXT) tx.executeSql("INSERT INTO Unites(uniteName,uniteSymbol) VALUES(?, ?)", ['heure', 'h']); //fonctionnel un à la fois tx.executeSql("INSERT INTO Unites(uniteName,uniteSymbol) VALUES(?, ?)", ['kilometre', 'km']); //fonctionnel un à la fois tx.executeSql("INSERT INTO Unites(uniteName,uniteSymbol) VALUES(?, ?)", ['dollar', '$']); //fonctionnel un à la fois
A +
Alain source share