嗨,我正在寫與jQuery的CSS和JavaScript的菜單列表中顯示從數據庫菜單項:我想從數據庫中獲取的菜單項如何使用jQuery和JavaScript
JS代碼:
var selectAllStatement = "SELECT * FROM Contacts";
function findAll(){
var name;
db.transaction(function(tx) {
tx.executeSql(selectAllStatement, [], function(tx, result) {
dataset = result.rows;
for (var i = 0, item = null; i < dataset.length; i++) {
item = dataset.item(i);
name = item['firstName'] }
});
});
}
HTML文件:
<section id="popupAccordeon" class="hide">
<div id="popup-bg">
</div>
<div id="popup-box">
<ul class="niveau1">
<li><a href=""> Players Name</a>
<ul class="niveau2">
<li><a href="http://www.rankspirit.com"> </a></li> // this are items i want to get them from table Contacts
</ul>
</section>
你是否得到某種類型的錯誤消息與您的代碼?我同意MatuDuke有關使用PHP或類似的內容。 – Purplemonkey 2012-04-25 12:20:11