亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

模擬智能在線客服系統(tǒng)

原創(chuàng) 2019-01-20 00:42:46 254
摘要:按照老師的思路自己寫出來了,模擬只能在線客服系統(tǒng)。感覺老師的思路清晰,代碼簡潔。很容易掌握。很感恩老師的教學(xué)以下是HTML+CSS+JS代碼:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <me

按照老師的思路自己寫出來了,模擬只能在線客服系統(tǒng)。感覺老師的思路清晰,代碼簡潔。很容易掌握。很感恩老師的教學(xué)

1111.jpg


222.jpg

以下是HTML+CSS+JS代碼:

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.chart {
width: 550px;
height: 600px;
margin: 20px auto;
background-color: cadetblue;
border: 2px solid red
}

.chart ul {
margin: 20px auto;
padding: 0;
width: 500px;
height: 400px;
background-color: bisque
}

.chart li{
list-style: none;
height:30px;
font-size: 12px;
line-height:30px;
margin-top:10px;
padding:5px;
}
.chart li:nth-child(even){
color: red;
text-align: right
}
.chart li:nth-child(even) img{
float: right
}
.chart li img{
width: 30px;
height: 30px;
float: left;
margin-right: 5px;
border-radius: 50%;
}
.chart h3 {
width: 50%;
margin: 10px auto;
text-align: center;
height: 40px;
line-height: 40px;
color: white
}

.write {
width: 500px;
margin: 15px auto;
}

.write textarea {
width: 430px;
float: left;
height: 40px;
}

.write button {
float: right;
width: 60px;
border: none;
color: white;
height: 45px;
background-color: green
}
</style>
</head>

<body>
<div class="chart">
<h3>模擬智能在線客服系統(tǒng)</h3>
<ul>

</ul>

<div class="write">
<textarea name='text'></textarea>
<button>發(fā)送</button>
</div>
</div>
<script>
let ul = document.getElementsByTagName('ul')[0];
let text = document.getElementsByName('text')[0];
let btn=document.getElementsByTagName('button')[0];
let tx='<img src="images/tx.jpg"/>';
let sum=0
btn.onclick=function(){
let li = document.createElement('li');
li.innerHTML=tx+text.value;
ul.appendChild(li);
text.value='';
sum+=1;

// 設(shè)置2秒鐘后自動恢復(fù)
setTimeout(function(){
//  自動回復(fù)信息模板
let info=[
'請描述你的問題',
'請您重復(fù)描述你的問題',
'請您再重復(fù)一遍你的問題',
'好的',
'嗯,在呢',
'今天太晚了,明天再說吧。',
]
let li=document.createElement('li');
let Kfpic='<img src="images/tx2.jpg"/>';
let hf=info[Math.floor(Math.random()*5)];
li.innerHTML=Kfpic+hf;
ul.appendChild(li);
},2000)
}
</script>

</body>

</html>


發(fā)佈手記

熱門詞條