Tuesday, January 4, 2011

Scroll Title with JavaScript

The Code

<script language="JavaScript"><!--
var kiri="[";
var kanan="]";
var psn=" Segerombolan SemutHitam Yang Tengah Menyeret Sesosok Mayat Perempuan Tak Berbusana ";
var ngacir=200;
var t;
var lagi_scroll=0;

function scroll_title() {
        document.title=kiri+psn+kanan;
        psn=psn.substring(1,psn.length)+psn.charAt(0);
        t=setTimeout("scroll_title()",ngacir);
}

function do_scroll()
{
if (!lagi_scroll)
  {
  lagi_scroll=1;
  scroll_title();
  }
}

function stop_scroll()
{
clearTimeout(t);
lagi_scroll=0;
}
// End 
// --></script>

<a onClick="do_scroll();" style="cursor:pointer;"><b style="color:darkgreen;">Click to scroll</b></a><br/>
<a onClick="stop_scroll();" style="cursor:pointer;"><b style="color:darkred;">Click to STOP scroll</b></a>

Result

Click to scroll
Click to STOP scroll

No comments:

Post a Comment

shake js