»
EnglishFrenchVietnamese

Print - Simple JavaScript Chat Box with OOP Skill - JavaScriptBank.com

Full version: jsB@nk » Misc » Simple JavaScript Chat Box with OOP Skill
URL: https://www.javascriptbank.com/simple-javascript-chat-box-with-oop-skill.html

Simple JavaScript Chat Box with OOP Skill © JavaScriptBank.comThis JavaScript code example (JavaScript chat code) just help you learn more OOP in JavaScript by making a message box with chat-style window. A simple free JavaScript chat effect with a few codelines to try JavaScript OOP.Try more OOP in JavaScript techniques from our old JavaScript article tutorials at: - JavaScript OOP Form Input Fields Maker - Contexting OOP in JavaScript - Top 10 Free Web Chat box Plug-ins and Add-ons

Full version: jsB@nk » Misc » Simple JavaScript Chat Box with OOP Skill
URL: https://www.javascriptbank.com/simple-javascript-chat-box-with-oop-skill.html



CSS
<style type="text/css">div#list {  background-color: #DFDFDF;  color: #000;  overflow: scroll;  width: 15em;  height: 10em;  padding: 10px;  text-align: left;}</style>


JavaScript
<script type="text/javascript">// Created by: James Robertson | http://www.r0bertson.co.uk// This script downloaded from www.JavaScriptBank.comfunction addText() {  olist = document.getElementById('list');  op = document.createElement('p');  op.innerHTML = 'More text ...';  ocontent = document.getElementById('content');  ocontent.appendChild(op);  olist.scrollTop = olist.scrollHeight;}</script>


HTML
<p>A simple chat-style display</p><div id="list">  <div id="content">  <p class="other_user">Good afternoon. How are you?</p>  <p class="other_user">Hello?</p>  <p class="other_user">Is anybody there?</p>  </div></div><p><div id="toolbar"><input type="button" value="add text" onclick="addText()" /></div>