客服在线系统布局
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>DOM实战:模拟智能在线客服系统</title>
<style type="text/css">
div:nth-child(1){
width: 450px;height: 650px;
background: skyblue;margin: 30px auto;
color: #333;box-shadow: 2px 2px 2px #808080;
}
h2{
text-align: center;margin-bottom: -10px;
}
div:nth-child(2){
width: 400px;height: 500px;
border: 4px double green;
background: #efefef;
margin: 20px auto 10px;
}
ul{
list-style: none;
line-height: 2em;
overflow: hidden;
padding: 15px;
}
table{
width: 90%;height: 80px;
margin: auto;
}
textarea{
border: none;
resize: none;
background: lightyellow;
padding: 10px;
}
button{
width: 60px;
height: 40px;
background: seagreen;
border: none;
}
button:hover{
cursor: pointer;
background: orange;
}
</style>
</head>
<body>
<div>
<h2>在线客服</h2>
<div>
<ul>
<li></li>
</ul>
</div>
<table>
<tr>
<td align="right"><textarea name="text" cols="50" rows="4"></textarea></td>
<td align="left"> <button type="button">发送</button></td>
</tr>
</table>
</div>
<script type="text/javascript">
// 获取到页面中的元素
// 按钮
let btn = document.getElementsByTagName('button')[0];
// 输入内容
let text = document.getElementsByName('text')[0];
// ul元素
let list = document.getElementsByTagName('ul')[0];
// 计数器
let sum = 0;
</script>
</body>
</html>