返回在线客服 前台......登陆

在线客服 前台效果

红色熊猫2019-04-04 17:28:17191

<!doctype html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="ie=edge">
   <title>Document</title>
   <style>
.content{width: 500px;margin: 0 auto;background-color: blue;padding-top: 20px;padding-bottom: 20px}
       .chat{width:400px;margin: 0 auto;height: 400px;background-color: #fff;}
       .send{width:400px;margin: 0 auto;margin-top: 20px;}
       .clear{overflow: hidden}
       textarea{resize: none;width: 270px;height: 50px;float: left}
       button{width: 120px;height: 55px;float: right;font-size: 20px}
       li{list-style: none;margin-top: 10px}
       li img{display: inline}
   </style>
</head>
<body>
<div class="content">
<!--聊天区-->
<div class="chat"><ul></ul></div>

<!--发送区-->
<div class="send clear">
       <textarea></textarea>
       <button id="send">发送</button>
   </div>
</div>
<script>
window.onload=function () {
       var sum=0;
var send=document.querySelector('#send');
var ul=document.querySelector('ul');
var info=[
           'hello,worde',
'我饿了',
'我要吃饭',
'你不是好人',
'pbp指纹锁',
'我要回家  ',
'城市太露',
'我要回老家'
]

       send.onclick=function () {
           var tc=document.querySelector('textarea').value;
var li=document.createElement('li');
li.innerHTML="<img src=\"a.png\"/ style=\"border-radius:50%;width:25px;height:25px\">"+tc;
ul.appendChild(li);
sum++;

setTimeout(function () {
               //获取info的随机数据
var one=info[Math.floor(Math.random()*7)];//Math函数
var li0=document.createElement('li');
li0.innerHTML="<img src=\"b.png\"/ style=\"border-radius:50%;width:25px;height:25px\">"+one;
ul.appendChild(li0);
sum++;

if (sum>10){
                   ul.innerHTML='';
sum=0;
}
           },2000)
       }
   }




</script>
</body>
</html>

最新手记推荐

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

全部回复(0)我要回复

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