Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    countdown al contrario (quanti giorno sono passati)

    Salve a tutti,
    come da oggetto mi serve creare un counter al contrario,
    quindi quanti giorni sono passati da una data precisa.
    ho trovato online un buon countdown, ma a me servirebbe unazione che fa il contrario e
    che mi faccia vedere giorni ore minuti e secondo
    ovvimante i giorno devono diventare anche di 3 o 4 cifre
    questo si azzera al cambiare del mese.

    potreste darmi una mano?
    di seguito il codice
    spero di essere stato chiaro

    Grazie in anticipo


    onClipEvent (load) {
    countdown = "yes";
    // Target Time Information
    tyear = 2010;
    tmonth = 10;
    tday = 17;
    thours = 15;
    tminutes = 15;
    tseconds = 0;
    //
    }
    onClipEvent (enterFrame) {
    if (countdown == "yes") {
    mon = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
    daysinmonth = ["31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31"];
    now = new Date();
    nyear = now.getFullYear();
    nmonth = mon[now.getMonth()];
    ndays = daysinmonth[now.getMonth()];
    nday = now.getDate();
    nhours = now.getHours();
    nminutes = now.getMinutes();
    nseconds = now.getSeconds();
    // Year Code
    ryear = tyear-nyear;
    //Month Code
    if (tmonth>=nmonth) {
    rmonth = tmonth-nmonth;
    } else {
    rmonth = (12-nmonth)+tmonth;
    ryear = ryear-1;
    }
    // Day Code
    if (tday>=nday) {
    rday = tday-nday;
    } else {
    rday = (ndays-nday)+tday;
    rmonth = rmonth-1;
    if (rmonth<0) {
    ryear = ryear-1;
    rmonth = 12+rmonth;
    }
    }
    // Hour Code
    if (thours>=nhours) {
    rhours = thours-nhours;
    } else {
    rhours = (24-nhours)+thours;
    rday = rday-1;
    if (rday<0) {
    rmonth = rmonth-1;
    rday = Number(ndays)+Number(rday);
    if (rmonth<0) {
    ryear = ryear-1;
    rmonth = 12+rmonth;
    }
    }
    }
    // Minute Code
    if (tminutes>=nminutes) {
    rminutes = tminutes-nminutes;
    } else {
    rminutes = (60-nminutes)+tminutes;
    rhours = rhours-1;
    if (rhours<0) {
    rday = rday-1;
    rhours = 24+rhours;
    if (rday<0) {
    rmonth = rmonth-1;
    rday = Number(ndays)+Number(rday);
    if (rmonth<0) {
    ryear = ryear-1;
    rmonth = 12+rmonth;
    }
    }
    }
    }
    // Seconds Code
    if (tseconds>=nseconds) {
    rseconds = tseconds-nseconds;
    } else {
    rseconds = (60-nseconds)+tseconds;
    rminutes = rminutes-1;
    if (rminutes<0) {
    rhours = rhours-1;
    rminutes = 60+rminutes;
    if (rhours<0) {
    rday = rday-1;
    rhours = 24+rhours;
    if (rday<0) {
    rmonth = rmonth-1;
    rday = Number(ndays)+Number(rday);
    if (rmonth<0) {
    ryear = ryear-1;
    rmonth = 12+rmonth;
    }
    }
    }
    }
    }
    // Countdown Checker
    if (ryear<0) {
    disyear = 0;
    dismonth = 0;
    disday = 0;
    dishours = 0;
    disminutes = 0;
    disseconds = 0;
    discountdown = "no";
    this.play();
    countdown = "no";
    } else {
    // Update Clock Check
    if (ryear ne year) {
    year = ryear;
    if (year<10) {
    this.years.years.disyear = "0"+year;
    } else {
    this.years.years.disyear = year;
    }
    this.years.play();
    }
    if (rmonth ne month) {
    month = rmonth;
    if (month<10) {
    this.months.months.dismonth = "0"+month;
    } else {
    this.months.months.dismonth = month;
    }
    this.months.play();
    }
    if (rday ne day) {
    day = rday;
    if (day<10) {
    this.days.days.disday = "0"+day;
    } else {
    this.days.days.disday = day;
    }
    this.days.play();
    }
    if (rhours ne hours) {
    hours = rhours;
    if (hours<10) {
    this.hour.hour.dishours = "0"+hours;
    } else {
    this.hour.hour.dishours = hours;
    }
    this.hour.play();
    }
    if (rminutes ne minutes) {
    minutes = rminutes;
    if (minutes<10) {
    this.minute.minute.disminutes = "0"+minutes;
    } else {
    this.minute.minute.disminutes = minutes;
    }
    this.minute.play();
    }
    if (rseconds ne seconds) {
    seconds = rseconds;
    if (seconds<10) {
    this.second.second.disseconds = "0"+seconds;
    } else {
    this.second.second.disseconds = seconds;
    }
    this.second.play();
    }
    }
    }
    }

  2. #2
    Utente di HTML.it
    Registrato dal
    Feb 2009
    residenza
    Olbia
    Messaggi
    2,930

  3. #3
    mmm, non capisco come customizzarla come date...mi servirebbe qualcosa che posso gestire singolarmente per giorno ora minuti e secondi...
    grazie comunque

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.