No announcement yet.

MiceChat Countdown Feature

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • MiceChat Countdown Feature

    There's been some talk about a countdown feature, which will be coming "soon", and so I had a suggestion, for the script that is:

    HTML Code:
    //change the text below to reflect your own,
    var current=0
    var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
    function countdown(yr,m,d){
    var today=new Date()
    var todayy=today.getYear()
    if (todayy < 1000)
    var todaym=today.getMonth()
    var todayd=today.getDate()
    var todaystring=montharray[todaym]+" "+todayd+", "+todayy
    var futurestring=montharray[m-1]+" "+d+", "+yr
    var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
    if (difference==0)
    else if (difference>0)
    //enter the count down date using the format year/month/day
    This script would display the number of days only. The idea is that when you have the start tag (say, [countdown]) that would be everything up until "countdown(" you would then enter your date, (eg. 2005,5,5) and then the closing tag ([/countdown] would be the ")" and the </script>

    Set as mentioned above, the script would produce the following result:


    therefore, you would simply write:

    It's only [countdown]2005,5,5[/countdown] days until May 5!

    which would display as:

    It's only 29 days until May 5!

    and it would update itself every day. On the day in question, the script would display "0".

    This script, by the way, is a modified version of a script from the Javascript Kit.

    I'm not sure if it would work, I'm pretty sure it will, I read the FAQ on the vBulletin site to try to get a better undertstanding of how the vB scripts work, and I think this should work. I guess the admins can play around with it. Or maybe they've already been working on something. Anyway, hope this helps.
    Last edited by Club 33; 04-06-2005, 09:13 AM.

There is currently 1 user online. 0 members and 1 guests.

Most users ever online was 3,719 at 08:15 AM on 07-20-2012.