jeudi 21 janvier 2016

Creating a html dropdown list with the contents of a SQLite field

I am trying to make an SQLite field the contents of a drop down list in html using embedded JavaScript. This is the code I have but it does not work.

            <select>
            <option value="default">Select a test to edit</option>
            <script>
            var db = openDatabase('ExamSQL', '1.0', 'database')
            db.transaction(function (tx) {
                tx.executeSql('SELECT Questions FROM Question',[],function(tx,questions);
                {
                    var len = questions.rows.length, i;
                    for (i = 0; i < len; i++) {
                    </script><option value="name"><script>
                        document.write(questions.rows.item(i).text)
                        document.getElementById("name").innerHTML=questions.rows.item(i).text
                    </script></option>
                    <script>
                }
            });
            </script>
        </select>

Can anyone help?

Aucun commentaire:

Enregistrer un commentaire