2012-11-07 65 views

回答

0

有點您實現的更多細節可能是一個不錯的獎金:)

但是,如果我理解正確的,你,你可以像這樣做,基於jQuery Mobile的文檔:
http://jquerymobile.com/demos/1.2.0/docs/lists/docs-lists.html

// This is your HTML list 
<ul data-role="listview"> 
    <li><a href="acura.html">Acura</a></li> 
    <li><a href="audi.html">Audi</a></li> 
    <li><a href="bmw.html">BMW</a></li> 
</ul> 

// This is where you fetch data from database and add them to list 
function addToList (listId) { 
    var list = document.getElementById(listId); 

    // Iterate over items found in database here and add them to DOM 
    for (var i = 0 ; i < dataSource.length ; i += 1) { 
     liElem = document.createElement('li'); 
     liElem.textContent = dataSource[i]; 
     list.appendChild(liElem); 
    } 
    // Refresh the list 
    $(list).listview('refresh'); 
} 

簡單的演示:
http://jsfiddle.net/dR7fx/1/

+0

謝謝您的回答。 – user1768504

相關問題