73D41416194E8A7C390936971FB2B74B Chira Sathi: Scrolling Title in Browser title bar for blogspot

Monday, October 10, 2011

Scrolling Title in Browser title bar for blogspot



One of the most common uses of JavaScript is to create a scrolling message in the browser's status line. You can create a scrolling message using the string methods you have learned in this hour.
To begin, you'll need to define the message to be scrolled. You will use a variable called msg to store the message. To begin the script, initialize the variable (feel free to choose your own text for the message):



Steps to follow:

STEP #1
Log in to Blogger -> Layout -> Edit HTML and select the tick-box Expand Widget Templates
Then, find (CTRL+F) this code in the template

<head>

And immediately before it, paste this code:

<script type='text/javascript'>
//<![CDATA[
msg = "
==>triml.blogspot.com<==";
msg = " .................................. " + msg;pos = 0;
function scrollMSG() {
document.title = msg.substring(pos, msg.length) + msg.substring(0, pos); pos++;
if (pos > msg.length) pos = 0
window.setTimeout("scrollMSG()",200);
}
scrollMSG();
//]]>
</script>


Now click Save Template 

No comments:

Post a Comment

Best Blogger Gadgets