abstract:<!DOCTYPE html><html> <head> <title>DOM聊天信息生成原理</title> &nbs
<!DOCTYPE html>
<html>
<head>
<title>DOM聊天信息生成原理</title>
</head>
<body>
</body>
<script>
//創(chuàng)建input框
let input=document.createElement('input');
input.setAttribute('type','text');
document.body.appendChild(input);
//創(chuàng)建button按鈕
let but=document.createElement('button');
but.textContent='提交';
but.setAttribute('name','submit');
document.body.appendChild(but);
//創(chuàng)建ul
let ul=document.createElement('ul');
document.body.appendChild(ul);
let btn=document.getElementsByTagName('button').item(0);
//點(diǎn)擊button
btn.onclick=function(){
var li=document.createElement('li');
li.innerHTML=input.value;
ul.appendChild(li);
input.value='';
}
</script>
</html>
Correcting teacher:查無此人Correction time:2019-06-10 09:49:36
Teacher's summary:完成的不錯(cuò)??头到y(tǒng)完成后,可以想想客戶與客戶之間的聊天系統(tǒng)。繼續(xù)加油。