Results 1 to 3 of 3

Thread: Tip of the day for 365 days

  1. #1
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Post Tip of the day for 365 days

    1) Script Title: Tip of the day for 365 days

    2) Script URL (on DD): http://www.javascriptkit.com/script/...2/tipday.shtml

    3) Describe problem: I am not a programmer, but only a web designer; but having the ordinary ability to configure the scripts to suit designs.

    Some times before, Iíve witnessed a Tip of the day javascript for 365 days revised by a moderator, presumably Mr. Jscheuer1 (thread reference not remembered, but the script enclosed herewith as txt) based on an identical script for 31 days found in url http://www.javascriptkit.com/script/...2/tipday.shtml

    But when I structured it with 365 quotes (tips) to display a quote for each day and having tested, it displays only the seven quotes starting from tip No. 25, 26, 27, 28, 29, 30, 31 per day for a whole week without any problem and the same quotes are repeated for the next week and so on.

    Therefore I shall be much thankful, if the accuracy of the script is rechecked and modified to suit the latest browsing platforms and to enable me to have it completed in my designs.

    Thanking you so much in advance.
    Romesh

    Enclosed: (1) Daytip.html (as txt) (2) Daytip.js (as txt)
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,775
    Thanks
    2
    Thanked 411 Times in 406 Posts

    Default

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <head>
    <script type='text/javascript' >
    
    	function init(){
    
    		var tips = [];
    		tips[1] ='Accept the challenges so that you may feel the exhilaration of victory.<br><i>-George S. Patton-</i>';
    		tips[2] ='Do not worry when you are not recognized, but strive to be worthy of recognition.<br><i>-Abraham Lincoln-</i>';
    		tips[3] ='Do the difficult things while they are easy and do the great things while they are small.<br><i>-Lao Tzu-</i>';
    		tips[4] ='Take the first step in faith. You do not have to see the whole staircase.<br><i>-Martin Luther King Jr-</i>';
    		tips[5] ='To penetrate and dissipate these clouds of darkness the general mind must be strengthened by education.<br><i>-Thomas Jefferson-</i>';
    		tips[6] ='Try not to become a man of success, but rather try to become a man of value.<br><i>-Albert Einstein-</i>';
    		tips[7] ='It is hard to beat a person who never gives up.<br><i>-Babe Ruth-</i>';
    		tips[8] ='Everyone thinks of changing the world, but no one thinks of changing himself.<br><i>-Leo Tolstoy-</i>';
    		tips[9] ='A quitter never wins and a winner never quits.<br><i>-Napoleon Hill-</i>';
    		tips[10]='The snow goose need not bathe to make itself white. Neither need you do anything but be yourself.<br><i>-Lao Tzu-</i>';
    		tips[11]='Words that do not match deeds are unimportant.<br><i>Che Quevara</i>';
    		tips[12]='The only reason for time is so that everything does not happen at once; intellectuals solve problems; geniuses prevent them.<br><i>-Albert Einstein-</i>';
    		tips[13]='Fear stops you in your tracks. Self confidence propels you forward<br><i>-Aron-</i>';
    		tips[14]='Win without boasting. Lose without excuse.<br><i>-Albert Payson Terhune-</i>';
    		tips[15]='We are what we make ourselves. We only get out what we put in. Whatever the results are, we made it that way.<br><i>-Danielle Taylor-</i>';
    		tips[16]='Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity.<br><i>-General George S. Patton-</i>';
    		tips[17]='The goal of an effective leader is to recondition your team to be solution focused rather than problem focused.<br><i>-Jim Rohn-</i>';
    		tips[18]='You can fool all the people some of the time, and some of the people all the time, but you cannot fool all the people all the time.<br><i>-Abraham Lincoln-</i>';
    		tips[19]='One must accept finite disappointment, but never lose infinite hope.<br><i>-Martin Luther King Jr-</i>';
    		tips[20]='It’s not because things are difficult that we don’t dare, but its we don’t dare that things are difficult.<br><i>-Vince Lombardi-</i>';
    		tips[21]='The will to win is worthless if you do not have the will to poise.<br><i>-Thane Yost-</i>';
    		tips[22]='Believe in yourself and act on your convictions.<br><i>-Atron-</i>';
    		tips[23]='Earn your success based on service to others, not at the expense of others.<br><i>-H. Jackson Brown Jr-</i>';
    		tips[24]='Anyone who has never made a mistake has never tried anything new.<br><i>-Albert Einstein-</i>';
    		tips[25]='Good judgment comes from experience. Experience comes from bad judgment.<br><i>-Jim Horning-</i>';
    		tips[26]='I dream of men who take the next step instead of worrying about the next thousand steps.<br><i>-Theodore Roosevelt-</i>';
    		tips[27]='The person who takes a chance, who walks the line between the known and unknown, who is unafraid of failure, will only succeed.<br><i>-Gordon Parks-</i>';
    		tips[28]='Doing nothing is better than being busy doing nothing.<br><i>-Lao Tzu-</i>';
    		tips[29]='Management is doing things right; leadership is doing the right things.<br><i>-Peter F. Drucker-</i>';
    		tips[30]='Difficulties mastered are opportunities won.<br><i>-Sir Winston Churchill-</i>';
    		tips[31]='Setting an example is not the main means of influencing others; it is the only means.<br><i>-Albert Einstein-</i>';
    		tips[32]='A ship in the harbor is safe, but that is not what ships are built for.<br><i>-William Shedo-</i>';
    		tips[33]='You cannot escape the responsibility of tomorrow by evading it today.<br><i>-Abraham Lincoln-</i>';
    		tips[34]='We cannot be sure of having something to live for, unless we are willing to die for it.<br><i>-Che Quevara-</i>';
    		tips[35]='He who conquers others is strong; he who conquers himself is mighty.<br><i>-Lao Tzu-</i>';
    		tips[36]='A superior man is modest in his speech, but exceeds in his actions.<br><i>-Confucius-</i>';
    		tips[37]='Do not grieve that your roses have thorns, rejoice instead that your thorns have roses.<br><i>-Author unknown-</i>';
    		tips[38]='Do not bite at the bait of pleasure, till you know there is no hook beneath it.<br><i>-Thomas Jefferson-</i>';
    		tips[39]='Not everything that counts can be counted and not everything that can be counted counts.<br><i>-Albert Einstein-</i>';
    		tips[40]='A genuine leader is not a searcher for consensus but a molder of consensus.<br><i>-Martin Luther King Jr-</i>';
    		tips[41]='Someone is sitting in the shade today because someone planted a tree a long time ago.<br><i>-Warren Buffett-</i>';
    		tips[42]='An ounce of action is worth a ton of theory.<br><i>-Friedrich Engels-</i>';
    		tips[43]='It is wise to keep in mind that neither success nor failure is ever final.<br><i>-Roger Babson-</i>';
    		tips[44]='Success is the ability to go from failure to failure without losing your enthusiasm.<br><i>-Sir Winston Churchill-</i>';
    		tips[45]='Obstacles are those frightful things you see when you take your eyes off the goal.<br><i>-Henry Ford-</i>';
    		tips[46]='Darkness cannot drive out darkness, only light can do that; hate cannot drive out hate, only love can do that.<br><i>-Martin Luther King Jr-</i>';
    		tips[47]='Live as if you were to die tomorrow; learn as if you were to live forever.<br><i>-Magathma Gandhi-</i>';
    		tips[48]='What you get by achieving your goals is not as important as what you become by achieving your goals.<br><i>-Zig Ziglar';
    		tips[49]='The wise man does not lay up his own treasures. The more he gives to others, the more he has for his own.<br><i>-Lao Tzu-</i>';
    		tips[50]='What you think of yourself is much more important than what others think of you.<br><i>- Seneca-</i>';
    		tips[51]='The difference between stupidity and genius is that genius has its limits.<br><i>-Albert Einstein-</i>';
    		tips[52]='Have a heart that never hardens, and a temper that never tires, and a touch that never hurts.<br><i>-Charles Dickens-</i>';
    		tips[53]='Never leave that til tomorrow which you can do today.<br><i>-Benjamin Franklin-</i>';
    		tips[54]='Only those who dare to fail greatly can ever achieve greatly.<br><i>-Robert F. Kennedy-</i>';
    		tips[55]='An optimist sees an opportunity in every calamity; a pessimist sees a calamity in every opportunity.<br><i>-Sir Winston Churchill-</i>';
    		tips[56]='Hard work beats talent when talent fails to work hard.<br><i>-Kevin Durant-</i>';
    		tips[57]='Politics is war without bloodshed while war is politics with bloodshed.<br><i>-Mao Zedong-</i>';
    		tips[58]='The law of flotation was not discovered by the contemplation of the sinking of things.<br><i>-Thomas Troward-</i>';
    		tips[59]='A foolish consistency is the hobgoblin of little minds.<br><i>-Ralph Waldo Emerson-</i>';
    		tips[60]='Where wealth accumulates men decay.<br><i>-Oliver Goldsmith-</i>';
    		tips[61]='Forgiveness is the fragrance that the violet sheds on the heel that has crushed it.<br><i>-Mark Twain-</i>';
    		tips[62]='A truly good man does nothing, yet leaves nothing undone.<br><i>-Tao Te Ching-</i>';
    		tips[63]='Change wears a double face. Almost none wants to change himself yet virtually everyone wants to change others.<br><i>-Anuj Somany-</i>';
    		tips[64]='Choose a job you love, and you will never have to work a day in your life.<br><i>-Confucius-</i>';
    		tips[65]='The greatest danger for most of us is not that we aim too high and we miss it, but we aim too low and reach it.<br><i>-Michel Angelo-</i>';
    		tips[66]='Tip 66';
    		tips[67]='Tip 67';
    		tips[68]='Tip 68';
    		tips[69]='Tip 69';
    		tips[70]='Tip 70'; /* until tips 365*/
    		tips[71]='When one door of happiness closes, another opens; but often we look so long at the closed door that we do not see the one which has been opened for us.<br><i>-Helen Keller-</i>';
    
    		/* Do not edit below this line */
    
    		var tipDisplay = "";
    		var endDate = new Date();
    		var startDate = new Date("1/1/"+endDate.getFullYear());
    		var daysApart = Math.floor((endDate-startDate)/86400000);
    		var nDiv = document.getElementsByTagName('div');
    		for (var i=0; i<nDiv.length; i++)
    			{
    			 if (nDiv[i].className == "tipoftheday")
    				{
    				 tipDisplay = nDiv[i];
    				}
    			}
    		tipDisplay.innerHTML = tips[daysApart%(tips.length-1)+1]; // using an array starting at field 1 of any length
    	}
    
    	navigator.appName == "Microsoft Internet Explorer" ? attachEvent('onload', init, false) : addEventListener('load', init, false);
    </script>
    </head>
    
    <body>
    <p>
    <div align="center"><strong>Quote of the day</strong>
    <br/>
    <br />
    <div class="tipoftheday"></p></div>
    </div>
    
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. The Following User Says Thank You to vwphillips For This Useful Post:

    romeshlogan (09-03-2013)

  4. #3
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much for the rectified code Mr. Philip. Presumably it should work without any prob as the matter is now nailed to rest. As kindly advised, I would contribute to the Operation Smile Charity fund as much as I could.

    God loves each of us as if there were only one of us. ~ Augustine

    God bless !!!
    Romesh

Similar Threads

  1. Resolved adding days to date
    By NDK in forum JavaScript
    Replies: 3
    Last Post: 06-30-2009, 10:53 AM
  2. Resolved Determining days in any given month
    By hosdank in forum PHP
    Replies: 2
    Last Post: 05-14-2009, 03:13 PM
  3. Add Days to a date
    By fastrobby in forum JavaScript
    Replies: 0
    Last Post: 07-10-2007, 10:33 PM
  4. The good old days
    By Jack in forum The lounge
    Replies: 3
    Last Post: 11-17-2006, 04:58 AM
  5. Adding days to a date
    By johnnyi in forum JavaScript
    Replies: 1
    Last Post: 07-22-2005, 03:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •