<div class="codetitle"> <span><a style="CURSOR: pointer" data="32064" class="copybut" id="copybut32064" onclick="doCopy('code32064')"><u>複製程式碼</u></a></span>程式碼如下:</div> <div class="codebody" id="code32064"> <br><script type="text/javascript" src="js/%20jquery%20-1.7.1.min.js"></script> <br> <br>$(function(){ <br>$("#getAtr").click(function(){ <br>$ str=''; <br>$str ="<tralign>"; <br>$str ="<td></td>"; <br>$str ="<td> ;</td>"; <br>$str ="<td></td>"; <br>$str ="<td><input type="text" name="advSource[]"></td>"; <br>$str ="<td>"; <br>$str ="</td> <td></td>"; <br>$str ="<td onclick="getDel(this)"><a href="#">追加刪除</a></td> "; <br>$str =""; <br>$("#addTr").append($str); <br>}) <br>}); <br><br>函數getDel(k){ <br>$(k).parent().remove(); <br>} <br>腳本> <br><br>------------ -------------------------------------------- ------ ------------------------------------------ <br>html部分<br> <br><tralign> <br><td>廣告名稱</td> <br><td>廣告圖片</td> <br><td>廣告內容</td> <br><td>廣告來源</td> <br><td>廣告作者</td> <br><td>廣告描述</td> <br><tdalign><a href="#" id="getAtr">追加內容</a> <br> <br><tbody id="addTr"> <br><tralign> <br><td><input type="text" name="advTitle[]"></td> <br><td><input type="file" name="img[]"></td> <br><td><input type="text" name="advContent[]"></td> <br><td><input type="text" name="advSource[]"></td> <br><td> <input type="text" name="advAuthor[]"> td> <br> </td> <td><input type="text" name="advPosition[]"></td> <br><td></td> <br> <br> tbody> <br><tralign> <br><td colspan="5"><input type="submit" value="全部加"></td> <br> <br>表> <br></tralign></tralign> </tbody></tdalign></tralign></tralign> </div>