< form > < input type ="button" onclick ="addline()" value ="增加一行" > < table border ="1" id ="test" > < tr > < td colspan ="2" >< input type ="text" name ="tt[]" ></ td > </ tr > </ table > < input type ="submit" > </ form > < script > ... function addline(content)...{ newline=document.all.test.insertRow(); newline.insertCell().innerHTML='<input type="text" name="tt[]"><input type="button" value="删除此行" οnclick="del()">' } function del()...{ document.all.test.deleteRow(window.event.srcElement.parentElement.parentElement.rowIndex); } </ script > 用js来控制表格,添加和删除一行。