2012-04-05 121 views
1

我正在用jquery mobile構建一個web應用程序,我需要從外部數據庫獲取數據並將數據顯示爲可摺疊內容。JQuery mobile動態添加可摺疊內容php

<div data-role="collapsible" data-theme="b" data-content-theme="d" data-collapsed="true"> 
    <?php 


// display the results returned 
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
    printf('<h3><b> %s </h3> 
    <p> %s <p>',$row["OSO"], $row["AIKA"]); 
} 


     ?> 

我怎樣才能讓每一個H3顯示爲一個可摺疊的內容標題?現在只顯示爲標題,其餘第一是在內容部分

回答

1

如果您要多個頭你應該做一個新的可摺疊項爲每個條目...

<?php 
// display the results returned 
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
?> 
<div data-role="collapsible" data-theme="b" data-content-theme="d" data-collapsed="true"> 
    <h3><?= $row["OSO"] ?></h3> 
    <p><?= $row["AIKA"] ?><p> 
</div> 
<?php } ?> 
相關問題