Display Random Quotes with JavaScript

This snippet code allows you to prevent the viewer from being able to right-click on your page. This can discourage the average user from borrow images or code from your site.

[View All Snippets]
Show Plain Text »
  1. <script type="text/javascript">
  2. writeRandomQuote = function () {
  3.    var quotes = new Array();
  4.    quotes[0] = "Action is the real measure of your intelligence.";
  5.    quotes[1] = "The baseball has a great advantage over cricket of being sooner ended.";
  6.    quotes[2] = "Every goal, every action, every thought, every feeling one experiences, whether it be consciously or unconsciously known, is an attempt to increase one’s level of peace of mind.";
  7.    quotes[3] = "A good head and a good heart are always a formidable combination.";
  8.    var rand = Math.floor(Math.random()*quotes.length);
  9.    document.write(quotes[rand]);
  10. }
  11. writeRandomQuote();
  12. </script>
  14. <script type="text/javascript">writeRandomQuote();</script>

Create Your Free Account
Please remember that this information is essential to use our services correctly.
After creating the account you will be able to download all of our FREE products.
Fields marked with * are mandatory

Please send me information about updates, new products, specials and discounts from ApPHP!
We recommend that your password should be at least 6 characters long and should be different from your username/email. Please use only letters of the English alphabet to enter your name.

Your e-mail address must be valid. We use e-mail for communication purposes (order notifications, etc). Therefore, it is essential to provide a valid e-mail address to be able to use our services correctly.

All your private data is confidential. We will never sell, exchange or market it in any way. Please refer to Privacy Policy.

By clicking "Create Account", you are indicating that you have read and agree to the ApPHP Terms & Conditions.

Quick Registration with: Facebook / Google