博主信息
博文 36
粉丝 0
评论 1
访问量 34301
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
聊天界面和选项卡
其琛的博客
原创
908人浏览过

聊天效果图DVY1O3GO72]@M[3UD]O@Y[F.png

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>微信聊天</title>
<style type="text/css">
.box{
width: 1070px;
height:740px; 
margin: auto;
overflow: hidden;
}
.box .one{
float: left;

}
.box .two{
float: left;
}
.box .three{
float: left;

}
.box .three .main{
width: 677px;
height: 480px;
background-color: #f5f5f5;
margin-top: -19px;
}
.box .three .main ul{
height: 100%;
list-style-type: none;
overflow-y:auto;
overflow-x: none
}
/*.box .three .main ul li{
background-color: #98E125;
}*/
.box .three .bottom{
border:1px solid #fff;
}
.box .three .bottom img{
line-height: 1px;
margin:0;
margin-left: -5px;

}
.box .three .bottom table{
margin: 0;
width: 675px;
height: 120px;
}
textarea{
width: 580px;
height: 100%;
resize: none;
border:none;
}
button{
display: block;
width: 82px;
height: 30px;
background-color: white;
border:1px solid #f5f5f5;
margin-bottom: -40px;
}
button:hover{
background-color: #2ba245;
cursor: pointer;
}
</style>
</head>
<body>
<div>
<div>
<img src="images/1.jpg">
</div>
<div>
<img src="images/2.png">
</div>
<div>
<div>
<img src="images/3.png">
</div>
<div>
<ul>
<li></li>
</ul>
</div>
<div>
<img src="images/4.png">
<table>
<tr>
<td>
<textarea cols="50" rows="4" name="text"></textarea>
</td>
<td><button>发送(s)</button></td>
</tr>
</table>
</div>
</div>
<script type="text/javascript">
var anniu=document.getElementsByTagName('button')[0]
var text=document.getElementsByName('text')[0]
var list=document.getElementsByTagName('ul')[0]
// var sum=0
    anniu.onclick=function () {
     if (text.value.length==0) {
     alert('发送内容不能为空')
     return false
     }

     var user= text.value
     text.value=''
     var li=document.createElement('li')
     // li.innerHTML=user
     var userpic = '<img src="images/5.png" width="30">'
     li.innerHTML=userpic+'<span style="background-color: #98E125;">'+user+'</span>'
     list.appendChild(li)
     // sum += 1
     setTimeout(function(){
     var info =['说话注意点,要不用钱砸死你~','说点好话,支付宝给你转账哦','好了,不聊了,我忙着会见各国总统呢','客服小马为你服务~','我可不是每天都接待的~']
     var temp=info[Math.floor(Math.random()*5)]
            var reply =document.createElement('li')
            var kefu = '<img src="images/6.png" width="30">'
            reply.innerHTML = kefu + '<span style="color:black;background-color: white">'+temp+'</span>'
     // reply.innerHTML=kefu+'你好,客服马云为你服务~'
     list.appendChild(reply)
     // sum += 1

     },1000)
   
  //    if (sum > 10) {
//  list.innerHTML = ''
//  sum = 0
// }

    }
</script>

</body>
</html>

手写如图qq_pic_merged_1522645215367.jpg

批改状态:合格

老师批语:
本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学