我想重复这些元素:包含一个单元格并选择菜单通过 while 从数据库中获取数据
<div id="orginal">
<td width="99">
<select name= "certificate" id="xx"
onchange="BK.Ajax.Updates('newfile.php?id='+document.getElementById('xx').value,'ajx');" size="1">
<option>.....</option>
<?
$sql_company=mysql_query("select * from company");
while ($row=mysql_fetch_array($sql_company))
{
echo "<option value='$row[id]'> ";
echo $row['name'] ;
echo "</option>";
}
?></select>
</td>
在另一个 div 中:
<div id="wrapper">
</div>
使用 Javascript 代码:
<script language="javascript">
function repeat()
{
var el = document.createElement('div');
var oldHTML = document.getElementById('orginal').innerHTML;
el.innerHTML = oldHTML;
document.getElementById('wrapper').innerHTML = el;
}
</script>