Webmaster Cash Program
 Upload & Sell Your Software
Upload & Sell Your Ebook
 Enter The AWT Service Center  Contact Applied Web Tools
 Purchase Some Advertising  Password Troubles? Click Here!
Knowledge Center
Want to write for Applied Web Tools? Send your Writer's Query to
Editor@AppliedWebTools.net for details.
HTML
Reference
&
Tutorial
CSS
Reference
&
Tutorial
DOM
Reference
&
Tutorial
JavaScript
Reference
&
Tutorial
50+ Programming Examples
Use HTML, CSS, DOM & JavaScript Together
Misc. Essays & Documents
You'll Find Just About Anything In Here
50+ Web Page Constructions
Learn the Art of Using HTML, CSS, DOM & JavaScript Together
 Changing Background Colors
 Event Triggering With onLoad
 Disabling The Right Click
 DOM Driven Color Changing
 Switching Images
 innerHTML Attribute Access
 Change With innerHTML
 Changing Positions
 Change Position With onMouseMove
 Change Text Position
 Interactivity Skills
 Type-writing A Message
 Auto-changing Text Size
 Making Text Scroll
 Blinking Text
 Simple Form Authentication
 Change Background Color Of An INPUT
 Change Text Color Of An INPUT
 Change Background Image Of An INPUT
 Select All Checkboxes
 Select Color Of The Submit Button
 Change Text Color Of A Submit Button
 Insert Background Image To A Button
 Change Color Of Drop Down List
 Change Text Color Of A Drop Down List
 Change Color Of A TEXTAREA
 Change The Text Color Of A TEXTAREA
 Insert An Image Into A TEXTAREA
 Change The Size Of An Image
 Change The Source Of An Image
 Change The Position Of An Image
 Change The Background Image
 Moving Images Around The Page
 Drag & Drop An Image
 A Simple Image Viewer
 A Shaking Image
 A Digital Clock
 Drop Down List Link
 Top Drop Down Menu
 Always On Top Menu
 Inset Border Buttons
 A Description Generating Menu
 An Image Generating Menu
 A Horizontal Sliding Menu
 A Click Horizontal Sliding Menu
 Returning Cursor Co-ordinates
 Making Text Follow The Cursor
 Attaching An Image To The Cursor
typewriting message

This method comes in handy when you want to type into a textarea box and have formatted text appear in any given place within the document. I’ve seen this used as the base of very complex and capable web applications that are used to develop the look of a document by adding CSS rules to the text that is being displayed.

<html>
<head>

<script type="text/javascript">
message="The best way to learn is to study examples ";
pos=0;
maxlength=message.length+1;

function writemsg() {
if (pos<maxlength) {
txt=message.substring(pos,0);
document.forms[0].msgfield.value=txt;
pos++;
timer=setTimeout("writemsg()",50);
}
}

function stoptimer() {
clearTimeout(timer);
}
</script>

</head>

<body onload="writemsg()" onunload="stoptimer()">

<form>
<input id="msgfield" size="65">
</form>

</body>
</html>


We used a nested if loop to test if the text being typed is to be displayed. Note that we used a timer to give a little bit of a lag between the time the key is pressed and the time that the character is displayed. This is so the rest of the functions of the browser – which follows a bubbling or much the same as the documents it displays – can have sufficient time to apply the formatting to the text it has been told to display. An onLoad event handler is used to begin the function as the page has completed loading.
Want a copy of the Applied Web Tools Knowledge Center on your site?

Over 1200 individual command definitions in a really cool interface

Send your query to Sales@AppliedWebTools.net for details
I do not employ cookies or tracking devices of any kind