05 February 2011

Featured Posts Random Text

I will discuss how to display a random text using JavaScript. This script can be used for example to display the words of pearls or wise words to decorate your blog.

See the code below


<script language="JavaScript">
var Quotation=new Array() // Do not change this code

Quotation[0] = "Tutorial Blog";
Quotation[1] = "Internet Business";
Quotation[2] = "Tips & Trick";
Quotation[3] = "SEO Tips";
Quotation[4] = "Free Template";
Quotation[5] = "Basic Guide";

// ======================================
// Do not change this code
// ======================================
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();
</script>

Writing in red are the words that will appear randomly. Change this text according to your wishes.

This script can be placed on the front page or on every page / post you. Suppose that you refresh this page, the article below will change randomly.



Good Luck !!!

0 Comments:

Post a Comment