js实现微信聊天效果
作者:s_psycho 发布时间:2024-04-16 09:14:33
标签:js,微信聊天
本文实例为大家分享了js实现微信聊天效果的具体代码,供大家参考,具体内容如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin:0;
padding:0;
}
.box{
width: 250px;
height: 400px;
border: 1px solid #cccccc;
float: left;
margin-left: 200px;
position: relative;
}
.fox{
width: 250px;
height: 400px;
border: 1px solid #cccccc;
float: left;
margin-left: 200px;
position: relative;
}
.box1{
width: 250px;
height: 20px;
background: #cdcdcd;
line-height: 20px ;
text-align: center;
}
.fox1{
width: 250px;
height: 20px;
background: #cdcdcd;
line-height: 20px ;
text-align: center;
}
.box3{
width: 250px;
height: 30px;
bottom: 0px ;
position: absolute;
}
.fox3{
width: 250px;
height: 30px;
bottom: 0px ;
position: absolute;
}
.input1{
width: 200px;
height: 28px;
}
.input2{
width: 40px;
height: 30px;
}
.input3{
width: 200px;
height: 28px;
}
.input4{
width: 40px;
height: 30px;
}
.text1{
overflow: scroll;
overflow-x: hidden;
overflow-y: visible;
height: 350px;
}
.text2{
overflow: scroll;
overflow-x: hidden;
overflow-y: visible;
height: 350px;
}
</style>
</head>
<body>
<div class="box">
<div class="box1">AAAAAAAA</div>
<div class="text1"></div>
<div class="box3">
<input class="input1" type="text">
<input class="input2" type="button" value="发送">
</div>
</div>
<div class="fox">
<div class="fox1">BBBBBBBB</div>
<div class="text2"></div>
<div class="fox3">
<input class="input3" type="text">
<input class="input4" type="button" value="发送">
</div>
</div>
<script>
var oIpt1=document.getElementsByClassName("input1")[0];
var oIpt3=document.getElementsByClassName("input3")[0];
var oIpt2=document.getElementsByClassName("input2")[0];
var oIpt4=document.getElementsByClassName("input4")[0];
var oText1=document.getElementsByClassName("text1")[0];
var oText2=document.getElementsByClassName("text2")[0];
oIpt2.onclick=function () {
var newDate=new Date();
var oHouer=newDate.getHours();
var oMinutes=newDate.getMinutes();
var oSecond=newDate.getSeconds();
var oDiv1=document.createElement("div")
var oDiv2=document.createElement("div")
var oDiv3=document.createElement("div")
var oDiv4=document.createElement("div")
oDiv1.style.textAlign="right"
oDiv2.style.textAlign="left"
oDiv3.style.textAlign="center"
oDiv4.style.textAlign="center"
oText1.appendChild(oDiv3);
oText1.appendChild(oDiv1);
oText2.appendChild(oDiv4)
oText2.appendChild(oDiv2);
oDiv3.innerHTML=oHouer+"时"+oMinutes+"分"+oSecond+"秒"
oDiv4.innerHTML=oHouer+"时"+oMinutes+"分"+oSecond+"秒"
oDiv1.innerHTML=oIpt1.value;
oDiv2.innerHTML=oIpt1.value;
oIpt1.value=""
}
oIpt4.onclick=function () {
var newDate=new Date();
var oHouer=newDate.getHours();
var oMinutes=newDate.getMinutes();
var oSecond=newDate.getSeconds();
var oDiv1=document.createElement("div")
var oDiv2=document.createElement("div")
var oDiv3=document.createElement("div")
var oDiv4=document.createElement("div")
oDiv1.style.textAlign="center"
oDiv2.style.textAlign="center"
oDiv3.style.textAlign="right"
oDiv4.style.textAlign="left"
oText2.appendChild(oDiv1);
oText1.appendChild(oDiv2);
oText2.appendChild(oDiv3);
oText1.appendChild(oDiv4);
oDiv1.innerHTML=oHouer+"时"+oMinutes+"分"+oSecond+"秒"
oDiv2.innerHTML=oHouer+"时"+oMinutes+"分"+oSecond+"秒"
oDiv3.innerHTML=oIpt3.value;
oDiv4.innerHTML=oIpt3.value;
oIpt3.value=""
}
</script>
</body>
</html>
为大家推荐现在关注度比较高的微信小程序教程一篇:《微信小程序开发教程》小编为大家精心整理的,希望喜欢。
希望本文所述对大家学习javascript程序设计有所帮助。
来源:https://blog.csdn.net/weixin_42413689/article/details/80924950


猜你喜欢
- 新手小白,一直在为cmd窗口的暗白色文字感到苦恼,在网上找了许多方法(也就那两种吐舌头),现在稍微整理了一下,便于使用。效果图:import
- 一次性选中并修改多个相同的变量在编码的时候,有时候要批量替换一个变量的名字,但是又不想使用批量替换,因为在不同的作用域中是可以使用相同的变量
- 本文实例讲述了Python实现购物评论文本情感分析操作。分享给大家供大家参考,具体如下:昨晚上发现了snownlp这个库,很开心。先说说我开
- Exec sp_droplinkedsrvlogin ZYB,Null --删除映射(录与链接服务器上远程登录之间的映射) Exec sp_
- 一、安装环境gym是用于开发和比较强化学习算法的工具包,在python中安装gym库和其中子场景都较为简便。安装gym:pip instal
- 函数:endswith()作用:判断字符串是否以指定字符或子字符串结尾,常用于判断文件类型相关函数:判断字符串开头 startswith()
- 方法一: 1、打开查询分析器,输入命令 BACKUP LOG database_name WITH NO_LOG 2、再打开企业管理器--右
- 错误信息PS D:\parttime\python\django\guanxiangzhiji> python manage.py m
- Python编程中对于某些需要重复调用的程序,可以使用函数进行定义,基本形式为:def 函数名(参数1, 参数2, ……, 参数N):执行语
- 利用OpenCV练习读取图片的时候,图片总是一闪而过,不利于观察,这个时候需要利用到waitKey函数。waitKey函数:用来等待按键,当
- 窗口背景主要包括,背景色与背景图片,设置窗口背景有三种方法使用QSS设置窗口背景使用QPalette设置窗口背景实现PainEvent,使用
- format函数的调用format函数可以被直接调用或在print函数中以占位符实现格式化调用。在**2.6**版本前,占位符仍和其他语言一
- 本文实例讲述了Python实现复杂对象转JSON的方法。分享给大家供大家参考,具体如下:在Python对于简单的对象转json还是比较简单的
- 两周前,在给颜值在线的 flame 提交了几个 PR 之后,我将它封装成了容器,用于书签和在线应用的管理。但是在迁移个人
- GoroutineGoroutine 是 Golang 提供的一种轻量级线程,我们通常称之为「协程」,相比较线程,创建一个协程的成本是很低的
- 1、python内置的sqlite3模块,创建数据库中的表,并向表中插入数据,从表中取出所有行,以及输出行的数量。#!/usr/bin/en
- 本文实例讲述了Python生成随机数组的方法。分享给大家供大家参考,具体如下:研究排序问题的时候常常需要生成随机数组来验证自己排序算法的正确
- 在看论文《Detecting Regions of Maximal Divergence for Spatio-Temporal Anoma
- 本文实例讲述了Python实现清理微信僵尸粉功能。分享给大家供大家参考,具体如下:原理通过Pyhton调用itchat模块登录网页版微信,给
- 先来看一个例子:>>> def foo(*args, **kwargs): print