abstract:<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>实战聊天系统</title></head><body> <input type="text" name="info">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>实战聊天系统</title>
</head>
<body>
<input type="text" name="info">
<button>发送</button>
<ul>
</ul>
<script type="text/javascript">
let input = document.getElementsByName('info')[0];//获取文本框
let button = document.getElementsByTagName('button')[0];//获取按钮
let ul = document.getElementsByTagName('ul')[0];//获取ul
console.log(input,button,ul);
button.onclick = function(){
let li = document.createElement('li');//创建li
li.innerHTML = input.value;
ul.appendChild(li);
input.value = '';
}
</script>
</body>
</html>
Correcting teacher:韦小宝Correction time:2019-02-15 15:05:27
Teacher's summary:写的很简洁 学到现在完全可以写应该很逼真的聊天室啊 没事的时候可以研究研究哦!