Text Changing in notepad

Written by @kerixa 21 August 2012

This is a sample of changing texts in a text box. It changes very fast but you can set the time to what you actually want.

Code Snippet:

                                                
                                                <!-- this script is provided by www.javascriptfreecode.com coded by: Kerixa Inc. -->
<!-- A Script that types in a box that looks like notepad very cool

       The speed of the typing can be adjusted by raising 
       or lowering the number in the setTimeout function. 
-->

<script language="JavaScript">

function makeArray() 
{
  this.length = makeArray.arguments.length
  for (var i = 0; i < this.length; i++)
  this[i+1] = makeArray.arguments[i]
}

var fArray = new makeArray;
fArray[0]="Message 1 goes here. "
fArray[1]="Message 2 goes here. "
fArray[2]="Message 3 goes here. "
fArray[3]="Message 4 goes here. "

var x = 1;
var y = 0;
var msg1 = fArray[y];

function newsFeed() 
{
  if (x==msg1.length+1) 
  {
    for (var z=0; z < 7000; z++);
    y+=1;
    if (y > 3) y=0;
    document.form1.news2.value=' ';
    msg1 = fArray[y];
    x=0;
  }
  document.form1.news2.value=msg1.substring(0,x);  
  x+=1;
  setTimeout("newsFeed() ",1);
}
</script>

<body bgcolor=teal link=goldenrod onLoad="newsFeed()">

<form name="form1">
<textarea wrap=physical rows=10 cols=25 name="news2">
</form>
</body>
<a target='_blank' href='www.javascriptfreecode.com' style='font-size: 8pt; text-decoration: none'>JavaScript Best Codes</a>                                                
                                            

Example:


About @kerixa

I am Krishna Eydat. I studied Software Engineering at University of Waterloo in Canada. I lead a few tech companies. I am passionate about the way we are connected. I would like to be part of something big or be the big deal!

K

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: Shahmeer, coolcoco7, SmitaPatil25, owoboycute, 092010
advertisement 2