This is what the code looks like: <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- tomt=" "// skrivst=0// realdone=0// for(i=0;i<30;i++)//1 { tomt=tomt+" "// } alltext=tomt + "THIS PAGE WAS DESIGNED BY ilj"// function iljtext3()// { if(realdone<2)// { var skrivtext=alltext.substring(skrivst,alltext.length)//2 window.status = skrivtext//3 document.iljform.iljruta.value=skrivtext//4 skrivst++//5 iljtimer2 = setTimeout("iljtext3()",150)// if(skrivst==alltext.length+1)// { skrivst=0// realdone++// } } } //--> </SCRIPT> <FORM NAME="iljform"> <INPUT TYPE="text" SIZE="30" NAME="iljruta"> </FORM> Start the writing by a call eg after BODY ONLOAD, something like this: BODY ONLOAD="iljtext3()" ![]() Changes you have got to make and some changes you may want to do: I The text that will be displayed in the status bar is here written in CAPITALS - when you change the text, donīt remove the quotation marks! II The number (here 150) that decides how quickly the text will be written can be changed. In this example the text "is moved" one character to the left with an interval of 150 milliseconds. III You can change the number that sets the limit of how many times the text will be displayed. That number can be found on the functionīs first line which looks like this: if(realdone<2) This means that the function calls itself and writes the text as long as realdone is less than (<) 2. Initially realdone is set to 1. It then increases every time all the characters in the text have been written. realdone++ is the same thing as realdone=realdone+1 ![]() footnotes - MORE EXPLANATIONS 1 When the page is loaded a long text string is created (the first for loop). This text is saved in the variable alltext and looks (somewhat shortened and with the spaces represented by hyphens) like this: "----------------------THIS PAGE WAS" 2 Then the writing starts: the first time the function iljtext3 is called all the original text, beginning with the very first character since skrivst equals 0, is written: "----------------------THIS PAGE WAS" The next time the function is called skrivst has been increased by 1 (skrivst++) and the text that will be written this time does no longer include the first character but starts with the second: "---------------------THIS PAGE WAS" So, each time the function is called the original text string is shortened by one character, like this (spaces represented by hyphens): "----------------------THIS PAGE WAS" "---------------------THIS PAGE WAS" "--------------------THIS PAGE WAS" "-------------------THIS PAGE WAS" "------------------THIS PAGE WAS" 3 writes skrivtext (ie the part of the original text string that for the moment is saved in the variable skrivtext) to the status bar 4 writes skrivtext in a textbox named iljruta on a FORM named iljform 4 skrivst++ could also be written skrivst=skrivst+1 ![]() substring If you put a word or a sentence or just a sequence of characters in a variable you call ordet, like this ordet="flowsim" and then want to write different portions of it you can use substring like this: ordet.substring(0,ordet.length) show everyting that is in the variable ordet ordet.substring(2,ordet.length) start with the third character ordet.substring(2,4) show the third and fourth character ![]() Page by ![]() ilj@flowsim.se ![]() Last modified: August 22, 1998 This page should be part of a frames system at: http://www.flowsim.se |