Scrolling Text in TitleBar using JavaScript

Syedshakeer
Posted by Syedshakeer under JavaScript category on | Views : 7840
Scrolling Text in TitleBar using JavaScript

<html>
<head>
<script language="javascript">
var pos=0;var nar="This is the Message to Scroll"; 
function scroll()
{
document.title=nar.SubString(pos,nar.length)+nar.SubString(0,pos);
pos=(pos+1)%nar.length;
}
function Thisint()
{
SetInterval("Scroll()",100);
}
</script>

</head>
<body>
<a href="javascript:ThisInt()">StartScrolling</a>
</body>
</html>

Comments or Responses

Posted by: Raja on: 3/16/2009 Level:Starter | Status: [Member]
Hello Sayeed,

This code is not working, Is this working for you in your browser?
Posted by: Raja on: 3/16/2009 Level:Starter | Status: [Member]
I got this working, below is the correct code snippet.

<html>

<head>
<script language="JavaScript" type="text/javascript">
var message = " This is the Message to Scroll ";
function scroll() {
message = message.substring(1, message.length) + message.substring(0, 1);
document.title = message;
setTimeout("scroll()", 300);
}
</script>
</head>
<body>
<a href="javascript:scroll()">StartScrolling</a>
</body>
</html>


Thanks

Login to post response