Advertisement
mikit20

moving/scrolling title.

Aug 15th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. The first one:
  2.  
  3. <script type="text/javascript">
  4. var rev = "fwd";
  5. function titlebar(val)
  6. {
  7. var msg = "TITLE HERE";
  8. var res = " ";
  9. var speed = 100;
  10. var pos = val;
  11. msg = "TITLE HERE";
  12. var le = msg.length;
  13. if(rev == "fwd"){
  14. if(pos < le){
  15. pos = pos+1;
  16. scroll = msg.substr(0,pos);
  17. document.title = scroll;
  18. timer = window.setTimeout("titlebar("+pos+")",speed);}
  19. else{
  20. rev = "bwd";
  21. timer = window.setTimeout("titlebar("+pos+")",speed);}}
  22. else{
  23. if(pos > 0){
  24. pos = pos-1;
  25. var ale = le-pos;
  26. scrol = msg.substr(ale,le);
  27. document.title = scrol;
  28. timer = window.setTimeout("titlebar("+pos+")",speed);}
  29. else{
  30. rev = "fwd";
  31. timer = window.setTimeout("titlebar("+pos+")",speed);
  32. }}}
  33. titlebar(0);
  34. </script>
  35.  
  36.  
  37. The second one:
  38.  
  39. <script type="text/javascript">
  40. function tb8_makeArray(n){
  41. this.length = n;
  42. return this.length;
  43. }
  44. tb8_messages = new tb8_makeArray(3);
  45. tb8_messages[0] = "FIRST LINE";
  46. tb8_messages[1] = "SECOND LINE";
  47. tb8_messages[2] = "THIRD LINE";
  48. tb8_rptType = 'infinite';
  49. tb8_rptNbr = 5;
  50. tb8_speed = 100;
  51. tb8_delay = 2000;
  52. var tb8_counter=1;
  53. var tb8_currMsg=0;
  54. var tb8_tekst ="";
  55. var tb8_i=0;
  56. var tb8_TID = null;
  57. function tb8_pisi(){
  58. tb8_tekst = tb8_tekst + tb8_messages[tb8_currMsg].substring(tb8_i, tb8_i+1);
  59. document.title = tb8_tekst;
  60. tb8_sp=tb8_speed;
  61. tb8_i++;
  62. if (tb8_i==tb8_messages[tb8_currMsg].length){
  63. tb8_currMsg++; tb8_i=0; tb8_tekst="";tb8_sp=tb8_delay;
  64. }
  65. if (tb8_currMsg == tb8_messages.length){
  66. if ((tb8_rptType == 'finite') && (tb8_counter==tb8_rptNbr)){
  67. clearTimeout(tb8_TID);
  68. return;
  69. }
  70. tb8_counter++;
  71. tb8_currMsg = 0;
  72. }
  73. tb8_TID = setTimeout("tb8_pisi()", tb8_sp);
  74. }
  75. tb8_pisi()
  76. </script>
  77.  
  78.  
  79. The third one:
  80.  
  81. <script type='text/javascript'>
  82. msg = "YOUR MESSAGE HERE<==";
  83. msg = "AND HERE" + msg;pos = 0;
  84. function scrollMSG() {
  85. document.title = msg.substring(pos, msg.length) + msg.substring(0, pos); pos++;
  86. if (pos > msg.length) pos = 0
  87. window.setTimeout("scrollMSG()",200);
  88. }
  89. scrollMSG();
  90. //]]>
  91. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement