0

coding for retrieving data..

script

 function querySuccess(tx, results) 
            {
                    var len = results.rows.length;
                    console.log("DEMO table: " + len + " rows found.");
                    for (var i=0; i<len; i++)
                    {
                        console.log("Row = " + i + " name= " + results.rows.item(i).name+ " address=  " + results.rows.item(i).address+ " roll_no= " + results.rows.item(i).roll_no);
                        document.getElementById("list_view").innerhtml  = results.rows.item(i).name;
                    }
            }

html

 <div id="list_view" style="float:left; width:100%; padding:0px; margin:0px;">
                <ul style="float:left; width:100%; list-style:none; padding:0px; margin:0px;">
                    <div style=" border-bottom-color:#CCCCCC; border-bottom:ridge; "> <li style="font-size:18px"></li></div>
                </ul>
            </div>
    </body>
</html>

AM I CORRECT?? *how to set the data retrieved from the database as the div content?*

4

1 回答 1

2
document.getElementById("list_view").innerhtml  = results.rows.item(i).name;

变成

document.getElementById("list_view").innerHTML  = results.rows.item(i).name;

PS我明白了

<divid="list_view"...>

也许这只是 SO 上的一个意外错误,但请尝试检查“id”是否与“div”而不是“div”分开

于 2013-04-18T13:03:28.897 回答