PDA

View Full Version : JavaScript codes for Web DEV



JavaScriptBank
01-06-2011, 09:29 PM
Good and Nice JavaScripts

Simple JavaScript Chat Box with OOP Skill

This 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... detail (http://www.javascriptbank.com/simple-javascript-chat-box-with-oop-skill.html/en//) at JavaScriptBank.com - 2.000+ free JavaScript codes (http://www.javascriptbank.com/)


http://www.javascriptbank.com/javascript.images/misc/simple-javascript-chat-box-with-oop-skill.jpg (http://www.javascriptbank.com/javascript/misc/simple-javascript-chat-box-with-oop-skill/preview/en/)
Demo: JavaScript Simple JavaScript Chat Box with OOP Skill (http://www.javascriptbank.com/simple-javascript-chat-box-with-oop-skill.html/en/)


How to setup

Step 1: Use CSS code below for styling the script
CSS

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

Step 2: Use JavaScript code below to setup the script
JavaScript

<script type="text/javascript">
// Created by: James Robertson | http://www.r0bertson.co.uk
// This script downloaded from www.JavaScriptBank.com

function 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>

Step 3: Place HTML below in your BODY section
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>







JavaScript Line Graph script (http://www.javascriptbank.com/line-graph-script-index.html) - JavaScript Virtual Keyboard (http://www.javascriptbank.com/virtualkeyboard-index.html) - JavaScript Horizontal Slider (http://www.javascriptbank.com/horizontal-slider-javascript-v2-2.html)


The Site may provide, or third parties may provide, links to non-JavaScriptBank.com Internet World Wide Web sites or resources. Because JavaScriptBank.com has no control over such sites and resources, you acknowledge and agree that JavaScriptBank.com is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that JavaScriptBank.com shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.