abstrak: 首先要對此項目做一個布局.將布局放入一個大的div之中,在div中上方是在線客服的標題,下面第一部分是發(fā)送區(qū)內(nèi)容以及客服的相關回話,第二部分是文本輸入框以及發(fā)送按鍵,通過css對樣式進行簡單的布局,再在腳本中獲取相關的標簽.<!DOCTYPE html> <html> <head> <title&
首先要對此項目做一個布局.將布局放入一個大的div之中,在div中上方是在線客服的標題,下面第一部分是發(fā)送區(qū)內(nèi)容以及客服的相關回話,第二部分是文本輸入框以及發(fā)送按鍵,通過css對樣式進行簡單的布局,再在腳本中獲取相關的標簽.
<!DOCTYPE html> <html> <head> <title>模擬智能在線客服系統(tǒng)</title> <meta charset="utf-8"> <style type="text/css"> *{margin: 0px;padding: 0px} div:nth-child(1) { width: 450px; height: 650px; background-color: #acf; margin: 30px auto; color: #333 box-shadow: 2px 2px 2px #808080; } h2{ text-align: center; margin-bottom: -10px; font-weight: 400; font-family: 華文琥珀; } div:nth-child(2) { width: 400px; height: 500px; border: 5px double #ff6700; background-color: #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-color: lightyellow; } button { width: 60px; height: 40px; background-color: #F1AD7C; color: #000; border: none; font-family: 幼圓; font-weight: bold; } button:hover { cursor: pointer; background-color: ; color: #fff; } </style> </head> <body> <div> <h2>在線客服</h2> <div contenteditable="true"> <ul> <li></li> </ul> </div> <table> <tr> <td align="right"><textarea cols="50" rows="4" name="text"></textarea></td> <td align="left"><button type="button">發(fā)送</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>
Guru membetulkan:查無此人Masa pembetulan:2019-03-18 09:46:17
Rumusan guru:完成的不錯,邏輯很清晰。做功能就是想著怎么把它拼裝起來。繼續(xù)加油