try
<!doctype html>
<html>
<head>
</head>
<body>
<input id="txtCount" type="text" value="1" onchange="generate(this)"/>
<table id="tbl">
<thead>
<tr>
<th>Column1</th><th>Column2</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<script>
function generate() {
var value = document.getElementById('txtCount').value;
if (!isNaN(value)) {
var rows = parseInt(value);
var trs = [];
for (var i = 0; i < rows; i++) {
trs.push('<tr> <td> <input type="text" /> </td> <td> <input type="text" /> </td> </tr> ')
}
var tbodyHtml = trs.join('');
var tbody = document.querySelector('#tbl tbody');
tbody.innerHTML = tbodyHtml;
}
}
generate();
</script>
</body>
</html>