More About me

Im very passionate to write blogs about different topics such as Blogging, Online jobs, Internet etc. Im a graduate, cool, mature & still single guy (hehe...). I love to do internet surfing, watching every movies, & to help people.

More About Blog

I make this blog to know more & discuss topics such as blogging, world wide web, interesting stories, Online jobs. This blog is helpful to those people who just start doing blogging.

Random Posts Widget Blogger

Seen a lot people finding a Random Post widget for there blog? Then thought should have an tutorial on how to install it too in the blog.Well, here it is. If you want to know what it do is, whenever a reader click on link created by this widget all the times a different post will open for the reader in the blog as by luck.

Now lets see how to install it in your blog as it is very simple.

Go to Page Elements and click on Add a Gadget on the sidebar. Select HTML/Javascript and add the javascript code given below and save the widget/gadget.

<div id="myLuckyPost"></div> <script type="text/javascript"> function showLucky(root){ var feed = root.feed; var entries = feed.entry || []; var entry = feed.entry[0]; for (var j = 0; j < entry.link.length; ++j){if (entry.link[j].rel == 'alternate'){window.location = entry.link[j].href;}}} function fetchLuck(luck){ script = document.createElement('script'); script.src = '/feeds/posts/summary?start-index='+luck+'&max-results=1&alt=json-in-script&callback=showLucky'; script.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); } function feelingLucky(root){ var feed = root.feed; var total = parseInt(feed.openSearch$totalResults.$t,10); var luckyNumber = Math.floor(Math.random()*total);luckyNumber++; a = document.createElement('a'); a.href = '#random'; a.rel = luckyNumber; a.onclick = function(){fetchLuck(this.rel);}; a.innerHTML = 'Are ya feeling lucky, punk?'; document.getElementById('myLuckyPost').appendChild(a); } </script> <script src="/feeds/posts/summary?max-results=0&alt=json-in-script&callback=feelingLucky"></script>


I hope you will install it very easily Good Luck!!


Bookmark and Share



Subscribe to receive daily blogging tips in your inbox :

Delivered by FeedBurner

0 comments:

Post a Comment