Free Quotes/Ad Rotator Script

    • 34 posts
    January 29, 2023 12:52 AM PST

    Hi,

    Web Diva complimented me about my little Quotes Widget on my site Special Trusted Friends. It's a pretty simple script I got for free somewhere a number of years ago, originally an Ad Rotator but I just adapted it for motivational quotes, each time you visit or refresh the page a different Quote/Ad appears.

    Here is the script:

     

    var quotes=new Array()
    //change the quotes if desired. Add/delete additional quotes as desired.
    quotes[0]='There are some people who live in a dream world, and there are some who face reality; and then there are those who turn one into the other. <em>-Douglas Everett</em>';
    quotes[1]='Whether you think you can or whether you think you can\'t, you\'re right! <em>-Henry Ford</em>';
    quotes[2]='I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor. <em>-Henry David Thoreau</em>';
    quotes[3]='Do not let what you cannot do interfere with what you can do. <em>-John Wooden</em>';
    quotes[4]='Accept everything about yourself - I mean everything! You are you and that is the beginning and the end - no apologies, no regrets. <em>-Clark Moustakas</em>';
    quotes[5]='We must accept life for what it actually is - a challenge to our quality without which we should never know of what stuff we are made, or grow to our full stature. <em>-Ida R. Wylie</em>';
    quotes[6]='High achievement always takes place in the framework of high expectation. <em>-Jack Kinder</em>';
    quotes[7]='The measure of a man is the way he bears up under misfortune. <em>-Plutarch</em>';
    quotes[8]='Don\'t wait for your ship to come in, swim out to it. <em>-Anon</em>';
    quotes[9]='As I grow older, I pay less attention to what men say. I just watch what they do. <em>-Andrew Carnegie</em>';
    quotes[10]='No steam or gas ever drives anything until it is confined. No Niagara is ever turned into light and power until it is tunneled. No life ever grows until it is focused, dedicated, disciplined. <em>-Harry Emerson Fosdick</em>';
    quotes[11]='The words printed here are concepts. You must go through the experiences. <em>-Carl Frederick</em>';
    quotes[12]='Man cannot discover new oceans unless he has the courage to lose sight of the shore. <em>-Andre Gide</em>';
    quotes[13]='The wise man does at once what the fool does finally. <em>-Baltasar Gracian</em>';
    quotes[14]='The world has the habit of making room for the man whose actions show that he knows where he is going. <em>-Napoleon Hill</em>';
    quotes[15]='Success seems to be connected with action. Successful men keep moving. They make mistakes, but they don\'t quit. <em>-Conrad Hilton</em>';
    quotes[16]='Do the things you know, and you shall learn the truth you need to know. <em>-George Macdonald</em>';
    quotes[17]='I have never heard anything about the resolutions of the apostles, but a good deal about their acts. <em>-Horace Mann</em>';
    quotes[18]='Let us not be content to wait and see what will happen, but give us the determination to make the right things happen. <em>-Peter Marshall</em>';
    quotes[19]='I hear and I forget, I see and I remember. I do and I understand. <em>-Chinese Proverb</em>';
    quotes[20]='One may walk over the highest mountain one step at a time. <em>-John Wanamaker</em>';
    quotes[21]='Every action is either strong or weak, and when every action is strong we are successful. <em>-Wallace D. Wattles</em>';
    quotes[22]='If we do what is necessary, all the odds are in our favor. <em>-Henry Kissinger</em>';
    quotes[23]='Little minds are tamed and subdued by misfortune; but great minds rise above them. <em>-Washington Irving</em>';
    quotes[24]='When an affliction happens to you, you either let it defeat you, or you defeat it... <em>-Rosalind Russell</em>';
    quotes[25]='There\'s a basic human weakness inherent in all people which tempts them to want what they can\'t have and not want what is readily available to them. <em>-Robert J. Ringer</em>';
    quotes[26]='If there is something to gain and nothing to lose by asking, by all means ask! <em>-W. Clement Stone</em>';
    quotes[27]='It\'s not the situation... It\'s your reaction to the situation! <em>-Robert Conklin</em>';
    quotes[28]='Life at any time can become difficult: life at any time can become easy. It all depends upon how one adjusts oneself to life. <em>-Morarji Desai</em>';
    quotes[29]='What happens is not as important as how you react to what happens. <em>-Thaddeus Golas</em>';
    quotes[30]='To hell with circumstances; I create opportunities. <em>-Bruce Lee</em>';
    quotes[31]='Everyone wants, happiness. No one wants, pain. But you can\'t have a rainbow, without a little rain! <em>-Anon</em>';
    quotes[32]='I know you won\'t believe me, but the highest form of Human Excellence is to question oneself and others. <em>-Socrates</em>';
    quotes[33]='Nothing is impossible, the word itself says - I\'m Possible! <em>-Audrey Hepburn</em>';
    quotes[34]='Everyone wants happiness, no one wants pain, but you can\'t have a rainbow without a little rain! <em>-Anon</em>';
    quotes[35]='We cannot solve our problems with the same thinking we used when we created them. <em>-Ablert Einstein</em>';
    quotes[36]='Our mind is a garden, our thoughts are the seeds, we can grow flowers, or we can grow weeds. <em>-Anon</em>';
    quotes[37]='Don\'t be ashamed of your story, it will inspire others! <em>-Anon</em>';
    quotes[38]='Live less out of habit, and more out of intent! <em>-Anon</em>';
    quotes[39]='Be there for others, but never leave yourself behind. <em>-Dodinsky</em>';
    quotes[40]='Every new day is a chance to change your life! <em>-Anon</em>';
    quotes[41]='Be mindful of the future but not at the expense of the moment. <em>-Obi-Wan Kenobi</em>';
    var whichquote=Math.floor(Math.random()*(quotes.length));document.write(quotes[whichquote])

     


    To add a new Quote/Ad simply copy and paste the last one, eg:

     

    quotes[41]='Be mindful of the future but not at the expense of the moment. <em>-Obi-Wan Kenobi</em>';


    underneath the last quote and add 1 to the number, in this case 41 to 42, eg:

     

    quotes[41]='Be mindful of the future but not at the expense of the moment. <em>-Obi-Wan Kenobi</em>';
    quotes[42]='Put your new quote here! <em>-New Name</em>';


    Make sure any words with a single quote such as "Don't" you backslash the quote like "Don\'t"!


    Here is an example with AD Code:

     

    quotes[42]='<a rel="nofollow" href="https://your link to the product" target="_blank"><img style="width: 100%; max-width: 728px; height: auto;" src="https://your link to the product image jpg/png/gif" alt="Product Name" /></a>'


    The style for this example is a standard 728x90px ad.


    To display it I use two different methods.

    First method, simply enclose the code between div's, eg:

     

    <div style="text-align: center; margin: 0 auto; width: 100%; max-width: 728px; height: auto;">
    Script here!
    </div>


    Or to display the same code on multiple pages keeping the main code in one place, eg:

     

    <div style="text-align: center; margin: -15px 0 0 0;">
    <script src="/custom/js/motivational-quote-script.js"></script>
    </div>


    The advantage about this method is by keeping the script itself in one place/file, whenever you add a new Quote/Ad you only have to add it to the main file!

    Obviously, all styles would be to your own discretion and styling needs.

    Hope you like this, feel free to copy and use it and if you come up with any other uses for it please let me know, enjoy!


    Thank you and kind regards,

    Mark


    This post was edited by Mark Ransome at January 29, 2023 3:23 PM PST
    • Moderator
    • 233 posts
    January 29, 2023 9:10 AM PST
    Mark Ransome said: Hi, Web Diva complimented me about my little Quotes Widget on my site Special Trusted Friends. It's a pretty simple script I got for free somewhere a number of years ago, originally an Ad Rotator but I just adapted it for motivational quotes, each time you visit or refresh the page a different Quote/Ad appears. Here is the script:
    var quotes=new Array()
    //change the quotes if desired. Add/delete additional quotes as desired.
    quotes[0]='There are some people who live in a dream world, and there are some who face reality; and then there are those who turn one into the other. <em>-Douglas Everett</em>';
    quotes[1]='Whether you think you can or whether you think you can\'t, you\'re right! <em>-Henry Ford</em>';
    quotes[2]='I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor. <em>-Henry David Thoreau</em>';
    quotes[3]='Do not let what you cannot do interfere with what you can do. <em>-John Wooden</em>';
    quotes[4]='Accept everything about yourself - I mean everything! You are you and that is the beginning and the end - no apologies, no regrets. <em>-Clark Moustakas</em>';
    quotes[5]='We must accept life for what it actually is - a challenge to our quality without which we should never know of what stuff we are made, or grow to our full stature. <em>-Ida R. Wylie</em>';
    quotes[6]='High achievement always takes place in the framework of high expectation. <em>-Jack Kinder</em>';
    quotes[7]='The measure of a man is the way he bears up under misfortune. <em>-Plutarch</em>';
    quotes[8]='Don\'t wait for your ship to come in, swim out to it. <em>-Anon</em>';
    quotes[9]='As I grow older, I pay less attention to what men say. I just watch what they do. <em>-Andrew Carnegie</em>';
    quotes[10]='No steam or gas ever drives anything until it is confined. No Niagara is ever turned into light and power until it is tunneled. No life ever grows until it is focused, dedicated, disciplined. <em>-Harry Emerson Fosdick</em>';
    quotes[11]='The words printed here are concepts. You must go through the experiences. <em>-Carl Frederick</em>';
    quotes[12]='Man cannot discover new oceans unless he has the courage to lose sight of the shore. <em>-Andre Gide</em>';
    quotes[13]='The wise man does at once what the fool does finally. <em>-Baltasar Gracian</em>';
    quotes[14]='The world has the habit of making room for the man whose actions show that he knows where he is going. <em>-Napoleon Hill</em>';
    quotes[15]='Success seems to be connected with action. Successful men keep moving. They make mistakes, but they don\'t quit. <em>-Conrad Hilton</em>';
    quotes[16]='Do the things you know, and you shall learn the truth you need to know. <em>-George Macdonald</em>';
    quotes[17]='I have never heard anything about the resolutions of the apostles, but a good deal about their acts. <em>-Horace Mann</em>';
    quotes[18]='Let us not be content to wait and see what will happen, but give us the determination to make the right things happen. <em>-Peter Marshall</em>';
    quotes[19]='I hear and I forget, I see and I remember. I do and I understand. <em>-Chinese Proverb</em>';
    quotes[20]='One may walk over the highest mountain one step at a time. <em>-John Wanamaker</em>';
    quotes[21]='Every action is either strong or weak, and when every action is strong we are successful. <em>-Wallace D. Wattles</em>';
    quotes[22]='If we do what is necessary, all the odds are in our favor. <em>-Henry Kissinger</em>';
    quotes[23]='Little minds are tamed and subdued by misfortune; but great minds rise above them. <em>-Washington Irving</em>';
    quotes[24]='When an affliction happens to you, you either let it defeat you, or you defeat it... <em>-Rosalind Russell</em>';
    quotes[25]='There\'s a basic human weakness inherent in all people which tempts them to want what they can\'t have and not want what is readily available to them. <em>-Robert J. Ringer</em>';
    quotes[26]='If there is something to gain and nothing to lose by asking, by all means ask! <em>-W. Clement Stone</em>';
    quotes[27]='It\'s not the situation... It\'s your reaction to the situation! <em>-Robert Conklin</em>';
    quotes[28]='Life at any time can become difficult: life at any time can become easy. It all depends upon how one adjusts oneself to life. <em>-Morarji Desai</em>';
    quotes[29]='What happens is not as important as how you react to what happens. <em>-Thaddeus Golas</em>';
    quotes[30]='To hell with circumstances; I create opportunities. <em>-Bruce Lee</em>';
    quotes[31]='Everyone wants, happiness. No one wants, pain. But you can\'t have a rainbow, without a little rain! <em>-Anon</em>';
    quotes[32]='I know you won\'t believe me, but the highest form of Human Excellence is to question oneself and others. <em>-Socrates</em>';
    quotes[33]='Nothing is impossible, the word itself says - I\'m Possible! <em>-Audrey Hepburn</em>';
    quotes[34]='Everyone wants happiness, no one wants pain, but you can\'t have a rainbow without a little rain! <em>-Anon</em>';
    quotes[35]='We cannot solve our problems with the same thinking we used when we created them. <em>-Ablert Einstein</em>';
    quotes[36]='Our mind is a garden, our thoughts are the seeds, we can grow flowers, or we can grow weeds. <em>-Anon</em>';
    quotes[37]='Don\'t be ashamed of your story, it will inspire others! <em>-Anon</em>';
    quotes[38]='Live less out of habit, and more out of intent! <em>-Anon</em>';
    quotes[39]='Be there for others, but never leave yourself behind. <em>-Dodinsky</em>';
    quotes[40]='Every new day is a chance to change your life! <em>-Anon</em>';
    quotes[41]='Be mindful of the future but not at the expense of the moment. <em>-Obi-Wan Kenobi</em>';
    var whichquote=Math.floor(Math.random()*(quotes.length));<br>document.write(quotes[whichquote])
    To add a new Quote/Ad simply copy and paste the last one, eg:
    quotes[41]='Be mindful of the future but not at the expense of the moment. <em>-Obi-Wan Kenobi</em>';
    underneath the last quote and add 1 to the number, in this case 41 to 42, eg:
    quotes[41]='Be mindful of the future but not at the expense of the moment. <em>-Obi-Wan Kenobi</em>';
    quotes[42]='Put your new quote here! <em>-New Name</em>';
    Make sure any words with a single quote such as "Don't" you backslash the quote like "Don\'t"! Here is an example with AD Code:
    quotes[42]='<a rel="nofollow" href="https://your link to the product" target="_blank"><img style="width: 100%; max-width: 728px; height: auto;" src="https://your link to the product image jpg/png/gif" alt="Product Name" /></a>'
    The style for this example is a standard 728x90px ad. To display it I use two different methods. First method, simply enclose the code between div's, eg:
    <div style="text-align: center; margin: 0 auto; width: 100%; max-width: 728px; height: auto;">
    Script here!
    </div>
    Or to display the same code on multiple pages keeping the main code in one place, eg:
    <div style="text-align: center; margin: -15px 0 0 0;">
    <script src="/custom/js/motivational-quote-script.js"></script>
    </div>
    The advantage about this method is by keeping the script itself in one place/file, whenever you add a new Quote/Ad you only have to add it to the main file! Obviously, all styles would be to your own discretion and styling needs. Hope you like this, feel free to copy and use it and if you come up with any other uses for it please let me know, enjoy! Thank you and kind regards, Mark
    Wow, thank you Mark. So appreciate you adding this script.....this is a really nice script for quotes and always nice to see a new quote of the day at Special Trusted Friends. Positive Quotes are not only inspirational but they often can bring on conversation. Nice feature, thank you!