总结:
1创建好一个ul用于显示提交问题以及回答问题。
2创建一个文本框用于输入问题
3创建一个按钮用于提交发送问题
4在js脚本里获取一下页面上第一个按钮并赋值给变量btn
5在js脚本里获取一下输入框并赋值给text变量
6在js脚本里获取一下ul并赋值给变量list
7创建一个计数变量sum用于计数
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Document</title> <style> div:nth-child(1){ width: 450px; height: 650px; background: lightskyblue; 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; } button{ width: 60px; height: 40px; background: seagreen; color:white; border: none; } button:hover{ cursor: pointer; background: orange } </style> </head> <body> <div class=""> <h2>在线客服</h2> <div class=""> <ul> <li></li> </ul> </div> <table> <tr> <td> <textarea name="text" id="" cols="50" rows="4"></textarea> </td> <td> <button type="button">发送</button> </td> </tr> </table> </div> <script type="text/javascript"> let btn = document.getElementsByTagName('button')[0] let text = document.getElementsByName('text')[0]; let list = document.getElementsByTagName('ul')[0]; let sum = 0; </script> </body> </html>