<script>
function addinfo(){
var newTr = mytable.insertRow()
var newTd0 = newTr.insertCell()
var newTd1 = newTr.insertCell()
newTd0.innerHTML = document.getElementById("name").value
newTd1.innerText= document.getElementById("age").value
}
</script>
<table border="1" id="mytable">
<th>name</th><th>age</th>
</table>
<p>
name<input type="text" name="name" id="name">
</p>
<p>
age<input type="text" name="age" id="age">
</p>
<input type="submit" value="add" onClick="addinfo()">
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)