<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js练习6</title>
<script type="text/javascript">
window.onload = function () {
document.getElementById('btn1').onclick = function () {
//1.采集用户输入的数据
var user_name = document.getElementById('txtNickName').value;
var content = document.getElementById('txtContent').value;
//2.动态创建行
var trLine = document.createElement('tr');
var td1 = document.createElement('td');
td1.innerHTML = user_name;
<html lang="en">
<head>
<meta charset="UTF-8">
<title>js练习6</title>
<script type="text/javascript">
window.onload = function () {
document.getElementById('btn1').onclick = function () {
//1.采集用户输入的数据
var user_name = document.getElementById('txtNickName').value;
var content = document.getElementById('txtContent').value;
//2.动态创建行
var trLine = document.createElement('tr');
var td1 = document.createElement('td');
td1.innerHTML = user_name;