无刷新评论
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>无刷新评论</title> <script type="text/javascript"> function AddComment(){ var nickname = document.getElementByIdx_x("nickname").value; var comment = document.getElementByIdx_x("comment").value; var tableComment = document.getElementByIdx_x("tableComment"); var tr = document.createElement_x("tr"); var tdNickName = document.createElement_x("td"); tdNickName.innerText = nickname; tr.appendChild(tdNickName); var tdComment = document.createElement_x("td"); tdComment.innerText = comment; tr.appendChild(tdComment); tableComment.tBodies[0].appendChild(tr); } </script> </head> <body bgcolor="#662677"> 无刷新评论无刷新评论无刷新评论 <h3>评论区</h3> <table id="tableComment"> <tbody> <tr><td>小猪:</td><td>沙发哦!!!</td></tr> </tbody> </table> <br/> 昵称:<input type="text" id="nickname" /><br /> <textarea id="comment"></textarea><br /> <input type="button" value="评论" onclick="AddComment()" /> </body> </html>