Share this page 

Scroll a page title for special effectTag(s): Language


<html><head><title></title>
<script>
// reveal begin to end
var i = 0;
var j = 0;
var title = 
  "Special Effect-Real'sJavascriptHowTo@http://www.rgagnon.com/howto.html";
var titlelen = title.length;
var k;

function scrollControl() {
   scrollTitle();
   if(j < titlelen){
    clearTimeout(k);
   }
   j++;
   k=setTimeout("scrollControl();",5)
}

function scrollTitle() {
    var s = title.substring(0 ,i);
    document.title = s;
    i++;
}
scrollControl();
</script>
</head><body></body></html>
Try it here.

<html><head><title></title>
<script>
// scroll end to begin
var i = 0;
var j = 0;
var title = 
 "Special Effect-Real'sJavascriptHowTo@http://www.rgagnon.com/howto.html";
var titlelen = title.length;
var k;

function scrollControl() {
   scrollTitle();
   if(j < titlelen){
    clearTimeout(k);
   }
   j++;
   k=setTimeout("scrollControl();",5)
}

function scrollTitle() {
    var s = title.substring((titlelen - i - 1),titlelen);
    document.title = s;
    i++;
}
scrollControl();

</script>
</head><body></body></html>
Try it here.