How can I change text for 60 days through scripting?

Viewed 26

I'm kind of new at programming so bear with me because this is probably easy to solve but I just don't really have much practise.

I've been working on an automatic "daily tip" system, with tips each day for the first 3 months (60 days).

Basically a code that changes text every day for 60 days. After the 60 days, the idea I had was for the code to to reset and go back to the first tip, on the first day.

However, I can't seem to find a way to make the code place a different text when it gets back to sunday (0). It displays the first text again, instead of the second text I had planned.

I have no idea how to make it and have been stuck for 3 days thinking about this. I heard about these forums and decided to give it a go.

I don't know if I was clear, but if not, the idea is basically to:

if - Week1, sunday(0): Tecna: Need any guidance with our website? Visit the forums! They're the most practical way to get help from people just like you, as well as from the minimods! Plus, you get virtual coins for each message you post!

if - Week 2, sunday(0): Tecna: According to cyberpsychology, the nickname and avatar you chose and represent yourself with on the web can tell others a lot about you. So, choose carefully!

If you guys could find a way to make this work, I'd be very, very grateful! I have been browsing different topics related to this, but none attempted a text change if the week ends, resetting after 7 days. I want it to reset after 60.

    function Horoscopo() {
        var data = new Date();
        var dia = data.getDay()
        var mes = data.getMonth()
        var diames = data.getDate()
        
        // Weekly Tips
        if (dia == 0) {
            $("strong.tip").html("<span class='formalFont'>Why do you hear the sea in a seashell? Abandoned by the mollusks and other undersea animals, shells can be put up against your ear. The ambient noise around the shell will resonate inside the shell, creating a sound similar to crashing waves!</span>");
        }
        if (dia == 1) {
            $("strong.tip").html("<span class='formalFont'>Need any guidance with our website? Visit the forums! They're the most practical way to get help from people just like you, as well as from the minimods! Plus, you get virtual coins for each message you post!</span>");
            
        }
        if (dia == 2) {
            $("strong.tip").html("<span class='formalFont'>The forums are the best hangout spots to spend time with friends! Endless chats, tons of games, contests, stories... there's just so much fun! I don't even know where to begin!</span>");

        }
        if (dia == 3) {
            $("strong.tip").html("<span class='formalFont'>Put your feet in the spotlight! I have two choices for you: round toe boots from the 60s, with a low heel or wedge -- or heels wrapped in soft legwarmers!</span>");
        }
        if (dia == 4) {
            $("strong.tip").html("<span class='formalFont'>Vain Pirates? Not exactly! Pirates wore earrings because they believed piercing the ear could improve eyesight. It also helped them be recognized after death!</span>");
        }
        if (dia == 5) {
            $("strong.tip").html("<span class='formalFont'>What's the largest city in the world? It's Tokyo, the capital of Japan with a staggering 35.7 million people! Second is New York, followed by Sao Paulo and Seoul!</span>");
        }
        if (dia == 6) {
            $("strong.tip").html("<span class='formalFont'>The plants need plenty of water this season! Whatever you do, don't water them when the sun is high in the sky, that causes the leaves to burn! The ideal time is around sunset.</span>");
        }
</script>

<body onload="Horoscopo();">
    <div style="width:200px; float:left; padding-bottom:10px;">
        <div style="padding-bottom:0px;">

            <div style="background:url(../medias/images/Horoscope/totd_stella.png); width:207px; height:auto; background-repeat:no-repeat; background-color:#78cce4;">
                <table style="border: 0px; cellpadding: 0px; cellspacing: 0px">
                    <tbody>
                        <tr>
                            <td>
                                <div class="menuBlackFont" style="text-align: left; color:#FFFFFF; padding-top: 5px; padding-left: 10px; padding-bottom: 120px;">
                                    <span>Tip of the Day</span>
                                </div>

                                <div style="background:url(../medias/images/Horoscope/speech_bubble_top.png); width:200px; height:33px;">
                                </div>

                                <div style="background:url(../medias/images/Horoscope/speech_bubble_center.png);
                                        width:200px; background-repeat:repeat-y;">

                                    <div style="padding-left:15px; padding-right:15px;">
                                        <strong class="tip"><span class="formalFont"></span></strong>
                                    </div>
                                </div>

                                <div style="background:url(../medias/images/Horoscope/speech_bubble_bottom.png); width:200px; height:25px;"></div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>

            <p></p>
        </div>


0 Answers
Related