Random Quotes on Refresh Widget For Blogger / WebSites
Here is an interesting Blogger Widget which is meant to show random quotes on refreshing page. I wanted to show random quotes on my blog’s author box but unfortunately I could not find a single widget for this purpose which was quick and easy and do not effect page load. Then I found a few Java Scripts on Random Texts and Random Quotes merged them together to create a new and most convenient widget.
Let's say you want 10 quotes. In 'Array you will put 11 (which is the x +1 or 10 + 1 from the formula). That will make your code look like this:
If that doesn't clear it up, let me know!
Here are Installation Instructions For Blogger users, however other platform users can simply copy the code for their utilize.
For Bloggers
If you want to place it to sidebar. Otherwise simple copy the code and paste it to the
template editor between Body Tags.
- Open the Layout Editor
- Click 'Add a Page Element' ,
- and select 'Configure HTML/JavaScript'.
- Paste following code there ----->
<script language="JavaScript">
//store the quotations in arrays
quotes = new Array(6);
quotes[0] = "So many cats, so few recipes.";
quotes[1] = "Use the best: Linux for servers, Mac for graphics, Windows for Solitaire.";
quotes[2] = "That's not a haircut. That's a cry for help.";
quotes[3] = "The last thing I want to do is hurt you. But it's still on the list.";
quotes[4] = "Some days it's just not worth gnawing through the leather straps.";
quotes[5] = "Doing for blogging what Ghengis Khan did for social work.";
//calculate a random index
index = Math.floor(Math.random() * quotes.length);
//display the quotation
document.write("\n");
document.write(quotes[index]);
//done
</script>
- And CLick on save button.
quotes = new Array(X + 1);
and you add another line for each new quote:
quotes[X] = "Your new quote";
Let's say you want 10 quotes. In 'Array you will put 11 (which is the x +1 or 10 + 1 from the formula). That will make your code look like this:
first part of code.....
quotes = new Array(11);
quotes[0] = "So many cats, so few recipes.";
quotes[1] = "Use the best: Linux for servers, Mac for graphics, Windows for Solitaire.";
.....blah, more quotes, blah....
quotes[10] = "Doing for blogging what Ghengis Khan did for social work.";
.....last part of code
If that doesn't clear it up, let me know!
ABOUT THE AUTHOR
Hello We are OddThemes, Our name came from the fact that we are UNIQUE. We specialize in designing premium looking fully customizable highly responsive blogger templates. We at OddThemes do carry a philosophy that: Nothing Is Impossible
Thanks!
ReplyDelete