FAZA MESIACA (2)

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

174
p174.html / p174.zip
Urcuje aktualnu fazu mesiaca.
73026b
NN 4.04, IE 4.0

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD> <TITLE>JavaScript DESTINATION - P174</TITLE> <SCRIPT LANGUAGE="JavaScript"> <!-- function getMoonAge(year, month, day) { d = Math.floor(year/19) r = year-(d*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 "nov" if (moonAge<5) return "waning cresent" if (moonAge<11) return "prva stvrt" if (moonAge<13) return "waning gibbous" if (moonAge<16) return "spln" if (moonAge<20) return "waxing gibbous" if (moonAge<24) return "posledna stvrt" if (moonAge<29) return "waxing cresent" if (moonAge<30) return "nov" } function getMoonPhaseImg(moonAge) { if (moonAge<2) return "moonnew" if (moonAge<5) return "waningwcresent" if (moonAge<11) return "firstquarter" if (moonAge<13) return "waninggibbous" if (moonAge<16) return "moonfull" if (moonAge<20) return "waxinggibbous" if (moonAge<24) return "last quarter" if (moonAge<29) return "waxingcresent" if (moonAge<30) return "moonnew" } monthNames = new Array(13) monthNames[1] = "Januar" monthNames[2] = "Februar" monthNames[3] = "Marec" monthNames[4] = "April" monthNames[5] = "Maj" monthNames[6] = "Jun" monthNames[7] = "Jul" monthNames[8] = "August" monthNames[9] = "September" monthNames[10] = "Oktober" monthNames[11] = "November" monthNames[12] = "December" dayNames = new Array(8) dayNames[1] = "Nedela" dayNames[2] = "Pondelok" dayNames[3] = "Utorok" dayNames[4] = "Streda" dayNames[5] = "Stvrtok" dayNames[6] = "Piatok" dayNames[7] = "Sobota" function getLongDate(dateObj) { theDay = dayNames[dateObj.getDay()+1] theMonth = monthNames[dateObj.getMonth()+1] theDate = dateObj.getDate() theYear = 1900+dateObj.getYear() return ""+theDay+", "+theMonth+" "+theDate+", "+theYear } 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> </HEAD> <BODY BGCOLOR="#000000" TEXT="#FFFFFF"> <SCRIPT LANGUAGE="JavaScript"> <!-- theDate = new Date() theYear = theDate.getYear() theMonth = theDate.getMonth()+1 theDay = theDate.getDate() theMoonAge = getMoonAge(theYear, theMonth, theDay) theMoonPhase = getMoonPhase(theMoonAge) document.write(theMoonPhase+"<BR>") theMoonPhase = getMoonPhaseImg(theMoonAge) document.write("<img src='images/m2/"+ escape(theMoonPhase)+".gif' ALIGN='left' HSPACE='20'>") document.write("<P>Dnesny datum: "+getLongDate(theDate)+"<P>") document.write("Lunarny mesiac: "+theMoonAge) if (theMoonAge==1) { document.write(" dni od dnesneho dna<P>") } else { document.write(" dni od dnesneho dna<P>") } document.write("Nasledujuci <B>nov</B> bude: ") document.write(""+getLongDate( getNextNew(theMoonAge) )+"<P>") document.write("Nasledujuci <B>spln</B> bude: ") document.write(""+getLongDate(getNextFull(theMoonAge))+"<P>") document.write("<BR CLEAR=ALL>") //--> </SCRIPT> </BODY> </HTML>
[ Navrat / BACK ]