返回在线客服(上)......登陆

在线客服(上)学习总结

Mike2019-01-11 23:51:34253
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DOM实战:模拟智能在线客服系统</title>
    <style type="text/css">
        /*找到其父元素下的第一个div,这种写法很少见吧?写着乱乱的感觉,
        多个父的时候是选择第一个父级,第二个父级会控制到旗下的第一个元素
        是不是div如果是那就被控制*/
 div:nth-child(1) {
            width: 450px;
            height: 650px;
            background-color: 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-color: #efefef;
            margin: 20px auto 10px;
        }

        ul {
            list-style: none;
            line-height: 2em;
            /*border: 1px solid red;*/
 overflow: hidden;
            padding: 15px;
        }

        table {
            width: 90%;
            height:80px;
            margin: auto;
        }

        textarea{
            /*width: 300px;*/
 border: none;
            resize: none;
            background-color: lightyellow;

        }
        button {
            width: 60px;
            height: 40px;
            background-color: seagreen;
            color: white;
            border: none;
            /*text-align: left;*/

 }
        button:hover {
            cursor: pointer;
            background-color: orange;
        }
    </style>
</head>
<body>
<div>
    <h2>在线客服</h2>
    <!--contenteditable="true"属性则可以对该标签进行编辑-->
 <div contenteditable="true">
        <ul>
            <li></li>
        </ul>
    </div>
    <table>
        <tr>
            <td align="right">
                <!-- cols 和 rows 属性来规定 textarea 的尺寸cols是行,rows是列-->
 <textarea cols="50" rows="4" name="text"></textarea>
            </td>
            <td align="left">
                <button type=button>发送</button>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
    //先获取到所有dom元素

 //通过按钮标签名获取元素:ElementsByTagName
 let btn = getElementsByTagName('button')[0];
    //通过textarea文本域name名获取元素:getElementsByName
 let text = document.getElementsByName('text')[0];
    //通过按钮标签名获取元素:ElementsByTagName
 let list = document.getElementsByTagName('ul')[0];
    //计数器
 let sum = 0;
</script>
</body>
</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送