abstract:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>DOM实战:模拟在线客服系统</title> <style> div:nth-child(1){width
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>DOM实战:模拟在线客服系统</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-type: none;line-height: 2em;overflow: hidden;padding: 15px;} table{width: 90%;height: 80px;margin: auto;} textarea{border:0;resize: none;background: lightyellow;} button{width: 60px;height: 40px;background: seagreen;color: white;border:0;} button:hover{cursor: pointer;background: orange;} </style> </head> <body> <div> <h2>在线客服</h2> <div> <ul> <li></li> </ul> </div> <table> <tr> <td><textarea name="text" cols="50" rows="4"></textarea></td> <td align="left"><button type="button">发送</button></td> </tr> </table> </div> </body> </html> <script> // 获取到页面中相关元素 let btn = document.getElementsByTagName('button')[0]; let text = document.getElementsByName('text')[0]; let lists = document.getElementsByTagName('ul')[0]; let sum = 0; // 计数器初始化 // 添加点击事件,获取用户信息并发送到窗口 btn.onclick = function(){ alert(text.value) } </script>
Correcting teacher:韦小宝Correction time:2019-03-04 09:13:12
Teacher's summary:写的还是很不错的 把前面的样式部分相当于复习了一遍 没事要记得多去练习 继续加油吧!