Sunday, March 01, 2009

:.. Get your random banner too ..:

Another widget to share, as i manage to find code which randomly change my blog banners (neh... the one with "My Life, My Memories" tag on top).

So the reader wont get bored seeing the same banner everytime visiting my blog. It's quite useful and easy too. Within 3 steps, you can get your random banner ready.

But however, some pre-requisite steps should be taken before putting script below in your blog.

1) Get ready your banners, at least 2 to see how the banner changing everytime you refresh / press F5 your blog.
2) Adjust the size of the banner to fit your header size (you will be able to know what i meant after you placed the code)

Ok, so are you ready with your nice banners? Or if you don't mind, you can use mine toooo! :) Ok, Let's begin.

Step by Step Instruction
1. Login to your blogger account > Layout > Edit HTML (without expand Widget Templates)
2. Search for <body> code. And place this code right after <body>.

<script type="text/javascript">

var banner= new Array()

var random=Math.round(4*Math.random());

document.write("#header {");
document.write(' background:url("' + banner[random] + '") no-repeat left TOP;');
document.write(" }");


3. Customization (if any)

You will need to change the following:
a) The URL Locations of your graphics.
b) If you have 5 banners, you type "4" in the random number generating equation Math.round(4*Math.random()); If you have 3 banners type "2" and so forth.

It is working! Press "F5" on your keyboard and a different banner should appear.

Good luck! And let me know if it works! :)

Free Signature Generator

No comments:

Post a Comment