日期:2014-05-17  浏览次数:20858 次

innerHTML怎么会出错?
<table   width= "100% "   cellpadding=0   cellspacing=0   valign= "top ">
<form   id= "avote "   action= "addvoting.asp "   method= "post "   name= "addvote2 ">
<tr>
<td> 选项: </td>
<td> <a   href= "# "   onclick=add()> 添加 </a> </td>
</tr>
</form>
</table>
<script>
function   add()
{
var   f   =   document.getElementById( "avote ");
f.innerHTML   +=   " <tr> <td> 123 </td> <td> 456 </td> <td> 789 </td> </tr> ";
}
</script>
帮我看看吧!这个怎么改啊?


------解决方案--------------------
<div id= "add_tr ">
<table width= "100% " cellpadding=0 cellspacing=0 valign= "top ">
<tr>
<td> 选项: </td>
<td> <a href= "# " onclick=add()> 添加 </a> </td>
</tr>
</table>
</div>
<script>
function add()
{

add_tr.innerHTML += " <table width=\ "100%\ " cellpadding=0 cellspacing=0 valign=\ "top\ "> <tr> <td> 123 </td> <td> 456 </td> <td> 789 </td> </tr> </table> ";
}
</script>