La lune et ses cycles





   Télécharger ici le script ( 2 Ko )


   Copier entre les balises <head> et </head>


<script language="JavaScript" type="text/javascript">
<!-- Script trouvé par webmaster@gendnetclub.com-->
<!--
function getMoonAge(year, month, day)
{       
        d = Math.floor(year/19)
        r = year-(d*19) //r is the remainder of (year/19)
        while (r>9)
        {       
                r = r-19
        }
        r = r*11
        while (r>29)
        {       
                r = r-30
        }
        if (month<3)
        {       
                month = month+2
        }
        r = r+month+day
        if (year<100)
        {       
                r = r-4
        }
        else
        {
                r = r-8.3
        }
        while(r>29)
        {       
                r = r-30
        }
        while(r<0)
        {       
                r = r+30
        }
        return r
}
function getMoonPhase(moonAge)
{       
        if (moonAge<2) return "nouvelle"
        if (moonAge<5) return "décroissante"
        if (moonAge<11) return " au premier quartier"
        if (moonAge<13) return "décroissante"
        if (moonAge<16) return "pleine"
        if (moonAge<20) return "croissante"
        if (moonAge<24) return " au dernier quartier"
        if (moonAge<29) return "croissante"
        if (moonAge<30) return "nouvelle"
}
function getMoonPhaseImg(moonAge)
{       
        if (moonAge<2) return "moonnew"
        if (moonAge<5) return "waningcresent"
        if (moonAge<11) return "firstquarter"
        if (moonAge<13) return "waninggibbous"
        if (moonAge<16) return "moonfull"
        if (moonAge<20) return "waxinggibbous"
        if (moonAge<24) return "lastquarter"
        if (moonAge<29) return "waxingcresent"
        if (moonAge<30) return "moonnew"
}
monthNames = new Array(13)
monthNames[1]  = "Jan"
monthNames[2]  = "Fév"
monthNames[3]  = "Mars"
monthNames[4]  = "Avr"
monthNames[5]  = "Mai"
monthNames[6]  = "Juin"
monthNames[7]  = "Jui"
monthNames[8]  = "Août"
monthNames[9]  = "Sept"
monthNames[10] = "Oct"
monthNames[11] = "Nov"
monthNames[12] = "Dec"
dayNames = new Array(8)
dayNames[1]  = "Dim"
dayNames[2]  = "Lun"
dayNames[3]  = "Mar"
dayNames[4]  = "Mer"
dayNames[5]  = "Jeu"
dayNames[6]  = "Ven"
dayNames[7]  = "Sam"
function getLongDate(dateObj)
{       
        theDay = dayNames[dateObj.getDay()+1]
        theMonth = monthNames[dateObj.getMonth()+1]
        theDate = dateObj.getDate()
        theYear = dateObj.getFullYear()
        return ""+theDay+", "+theDate+" "+theMonth
}
function getNextFull(moonAge)
{       
        currMilSecs = (new Date()).getTime()
        daysToGo = 15 - moonAge
        while(daysToGo<2)
        {       
                daysToGo = daysToGo+29
        }
        milSecsToGo = daysToGo*24*60*60*1000
        nextMoonTime = currMilSecs+milSecsToGo
        nextMoonDate = new Date(nextMoonTime)
        return nextMoonDate
}
function getNextNew(moonAge)
{       
        currMilSecs = (new Date()).getTime()
        daysToGo = 29 - moonAge
        while(daysToGo<2)
        {       
                daysToGo = daysToGo+29
        }
        milSecsToGo = daysToGo*24*60*60*1000
        nextMoonTime = currMilSecs+milSecsToGo
        nextMoonDate = new Date(nextMoonTime)
        return nextMoonDate
}
//-->
</script>

 

   Copier entre les balises le <body> et </body> :

<script language="JavaScript" type="text/javascript">
<!--
theDate = new Date()
theYear = theDate.getYear()
theMonth = theDate.getMonth()+1
theDay = theDate.getDate()
theMoonAge = getMoonAge(theYear, theMonth, theDay)
theMoonPhase = getMoonPhase(theMoonAge)
theMoonPhase = getMoonPhaseImg(theMoonAge)
theMoonPhase = getMoonPhase(theMoonAge)
document.write(" La lune est  "+theMoonPhase+"<br>")
document.write("<strong>Nouvelle</strong> lune: ")
document.write(""+getLongDate( getNextNew(theMoonAge))+"<br>")
document.write("<strong>Pleine</strong> lune: ")
document.write(""+getLongDate(getNextFull(theMoonAge)))
document.write('<br clear=all>')
//-->
</script>

© Copyright GendNet 2000 Tout droit de reproduction strictement réservé aux membres de l'association ®

 Mesurez votre audience