home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 25: Programming / pc_actual_25.iso / Javascript / JavaScriptEditor / jse_en28.exe / %MAINDIR% / Library / News Ticker.js < prev    next >
Encoding:
JavaScript  |  2001-09-10  |  752 b   |  38 lines

  1. // 1996 by Christoph Bergmann... http://acc.de/cb
  2. // Please keep this note...
  3. // global variables
  4. var max=0;
  5. function textlist()
  6. {
  7.    max=textlist.arguments.length;
  8.    for (i=0; i<max; i++)
  9.         this[i]=textlist.arguments[i];
  10. }
  11. tl=new textlist
  12. (
  13.  
  14.     "Please insert a text here"
  15. );
  16. var x=0; pos=0;
  17. var l=tl[0].length;
  18.  
  19. function textticker()
  20.     document.tickform.tickfield.value=tl[x].substring(0,pos)+"_";
  21.  
  22.     if(pos++==l)
  23.     {
  24.         pos=0;
  25.         setTimeout("textticker()",1000);
  26.         x++;
  27.         if(x==max)
  28.             x=0;
  29.         l=tl[x].length;
  30.     } else
  31.         setTimeout("textticker()",50);
  32. }
  33.  
  34. document.write("<FORM NAME=\"tickform\">");
  35. document.write("<INPUT TYPE=\"TEXT\" NAME=\"tickfield\" SIZE=\"30\">");
  36. document.write("</FORM>");
  37. textticker();