<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>无刷新评论</title>
<script type="text/javascript">
function AppendComment() {
//获取昵称文本框的值
var nicknameValue = document.getElementById("nickName").value;
//获取评论文本框的值
var commentValue = document.getElementById("comment").value;
var tblComment = document.getElementById("tblComment");
var tr = tblComment.tBodies[0].insertRow(-1);
var tdNickName = tr.insertCell(-1);
tdNickName.innerHTML = nicknameValue;
var tdComment = tr.insertCell(-1);
tdComment.innerHTML = commentValue;
}
</script>
</head>
<body>
中国信鸽网站<br />
里面有丰富的信鸽图片,欢迎观赏
<p>评论</p>
<table id="tblComment" border="1">
<tbody>
<tr><td>李莫:</td><td>非常好的网站</td></tr>
</tbody>
</table>
昵称:<input type="text" id="nickName" /><br />
评论:<textarea id="comment"></textarea><br />
<input type="button" value="评论" οnclick="AppendComment()" />
</body>
</html>