简体   繁体   中英

how to set the data retrieved from the database as the div content?

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? *

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

becomes

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

PS i see

<divid="list_view"...>

maybe it's only an accidental error here on SO, but try to check if 'id' is separated from 'div' and not 'divid'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM