How do I show random text? Here I will explain how to display random text by using JavaScript.
This script can be used for example to display the words of pearls or wise words to decorate your blog.
Just see the code below:
<script language="JavaScript">
var Quotation=new Array() // don’t change this code
Quotation[0] = "Website Tutorial";
Quotation[1] = "Blog Guide";
Quotation[2] = "Website Programming";
Quotation[3] = "Free Templates";
Quotation[4] = "Free Blog Widget";
Quotation[5] = "Free Smiley";
// ======================================
// Don’t change code below
// ======================================
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();
</script>
Writing in Quotation are the words that will appear randomly. Change the texts according to your wishes.
This script can be placed on the front page or on every page / post. Suppose that you refresh this page, the text will change randomly.
Good luck!
0 comments:
Post a Comment