function addRow() { with (document) { var tb = $('tb'); var row = createElement("tr"); var td = createElement("td"); td.appendChild(createTextNode($F('id'))); row.appendChild(td); tb.appendChild(row); } }
<html> <head> <script type="text/javascript" src="prototype-1.6.0.3.js"> </script> <script type="text/javascript" src="table.js"> </script> </head> <body> <table border="1"> <tbody id="tb"></tbody> <input id="id" οnchange="addRow()"> </table> </body> </html>
<html> <head> <script type="text/javascript" src="prototype-1.6.0.3.js"> </script> <script type="text/javascript" src="table.js"> </script> </head> <body> <table border="1"> <tbody id="tb"></tbody> <input id="id" οnchange="addRow()"> </table> </body> </html>