This article has shared with you the specific code for JS to realize WeChat chat effect for your reference. The specific content is as follows
<!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="send"> </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="send"> </div> </div> <script> var oIpt1=("input1")[0]; var oIpt3=("input3")[0]; var oIpt2=("input2")[0]; var oIpt4=("input4")[0]; var oText1=("text1")[0]; var oText2=("text2")[0]; =function () { var newDate=new Date(); var oHouer=(); var oMinutes=(); var oSecond=(); var oDiv1=("div") var oDiv2=("div") var oDiv3=("div") var oDiv4=("div") ="right" ="left" ="center" ="center" (oDiv3); (oDiv1); (oDiv4) (oDiv2); =oHouer+"hour"+oMinutes+"point"+oSecond+"Second" =oHouer+"hour"+oMinutes+"point"+oSecond+"Second" =; =; ="" } =function () { var newDate=new Date(); var oHouer=(); var oMinutes=(); var oSecond=(); var oDiv1=("div") var oDiv2=("div") var oDiv3=("div") var oDiv4=("div") ="center" ="center" ="right" ="left" (oDiv1); (oDiv2); (oDiv3); (oDiv4); =oHouer+"hour"+oMinutes+"point"+oSecond+"Second" =oHouer+"hour"+oMinutes+"point"+oSecond+"Second" =; =; ="" } </script> </body> </html>
I hope this article will be helpful to everyone to learn JavaScript programming.
The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.