home *** CD-ROM | disk | FTP | other *** search
/ PC User 2005 May / CD / PCU0505CD.iso / software / full / coffecup / files / html2005.exe / %MAINDIR% / Javascript / Notepad.xml < prev    next >
Encoding:
Text File  |  2005-02-16  |  1.4 KB  |  66 lines

  1. <ccResource>
  2.   <ccTitle>
  3. Notepad
  4.   </ccTitle>
  5.   <ccCategory>
  6. Fun Stuff
  7.   </ccCategory>
  8.   <ccDescription>
  9. 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. 
  10.   </ccInstructions>
  11.   <ccHeadContent>
  12.   
  13.   </ccHeadContent>
  14.   <ccBodyContent>
  15. <script language="JavaScript">
  16.  
  17. function makeArray() 
  18. {
  19.   this.length = makeArray.arguments.length
  20.   for (var i = 0; i < this.length; i++)
  21.   this[i+1] = makeArray.arguments[i]
  22. }
  23.  
  24. var fArray = new makeArray;
  25. fArray[0]="Message 1 goes here. "
  26. fArray[1]="Message 2 goes here. "
  27. fArray[2]="Message 3 goes here. "
  28. fArray[3]="Message 4 goes here. "
  29.  
  30. var x = 1;
  31. var y = 0;
  32. var msg1 = fArray[y];
  33.  
  34. function newsFeed() 
  35. {
  36.   if (x==msg1.length+1) 
  37.   {
  38.     for (var z=0; z < 7000; z++);
  39.     y+=1;
  40.     if (y > 3) y=0;
  41.     document.form1.news2.value=' ';
  42.     msg1 = fArray[y];
  43.     x=0;
  44.   }
  45.   document.form1.news2.value=msg1.substring(0,x);  
  46.   x+=1;
  47.   setTimeout("newsFeed() ",1);
  48. }
  49. </script>
  50.  
  51.  
  52. <form name="form1">
  53. <textarea wrap=physical rows=10 cols=25 name="news2">
  54. </textarea>
  55. </form>
  56.   </ccBodyContent>
  57.   <ccElementContent>
  58.   
  59.    <ccElementName>onLoad</ccElementName>
  60.    <ccElementAction>newsFeed()</ccElementAction>
  61.    
  62.   </ccElementContent>
  63.   <ccExtraData>
  64.  
  65.   </ccExtraData>
  66. </ccResource>