KALENDAR (2)

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

 

198
p198.html / p198.zip
Slovenský kalendár
2040b
NN 4.04, MS IE 4.01

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<HTML> <HEAD> <title>JavaScript DESTINATION - P198</title> <script language="JavaScript"> <!-- function initArray() { this.length=initArray.arguments.length; for (var i=0;i<this.length;i++) { this[i]=initArray.arguments[i]; } } var Dny=new initArray("Pondelok/Monday","Utorok/Tuesday","Streda/Wednesday","Stvrtok/Thursday","Piatok/Friday","Sobota/Saturday","Nedela/Sunday"); var Mesice=new initArray("januar/january","februar/february","marec/march","april","maj/may","jun/june", "jul/july","august","september","oktober/october","november","december"); var pocetDni=new initArray(31,28,31,30,31,30,31,31,30,31,30,31); function Den(i) { return( (i==0) ? 7 : i ) } function Kalendar() { s="<TABLE BGCOLOR=\"#FFE5C0\" BORDER=5 CELLPADDING=5><TR><TH COLSPAN=7>"; dnes=new Date(); rok=dnes.getYear(); if (((rok % 4 == 0) && (rok % 100 != 0)) || (rok % 400 == 0)) pocetDni[1] = 29; s+=Dny[Den(dnes.getDay())-1]+" "+dnes.getDate()+". "+Mesice[dnes.getMonth()]+" "; s+=(dnes.getYear()>=2000) ? dnes.getYear() : 1900+dnes.getYear(); s+="<TR><TH><TT>Pon/Mon<TH><TT>Uto/Tue<TH><TT>Str/Wed<TH><TT>Stv/Thu<TH><TT>Pia/Fri<TH><TT>Sob/Sat<TH><TT>Ned/Sun<TR>" dnes.setDate(1); prvniDen=Den(dnes.getDay()); sloupec=1; for(i=1;i<prvniDen;i++) { s+="<TD>&nbsp"; sloupec++ } dnes=new Date(); dnesek=dnes.getDate(); posledniDen=pocetDni[dnes.getMonth()] for(i=1;i<=posledniDen;i++) { s+="<TD>"; if (sloupec==6) s+="<FONT COLOR=\"#0000FF\">"; if (sloupec==7) s+="<FONT COLOR=\"#FF0000\">"; if (i==dnesek) s+="<FONT COLOR=\"#00E000\"><B><BLINK>"; s+="<CENTER>"+i+"</CENTER>"; sloupec++; if (sloupec==8) { if (i!=posledniDen) s+="<TR>"; sloupec=1 } } if (sloupec!=1) for(i=sloupec;i<=7;i++) s+="<TD>&nbsp"; s+="</TABLE>"; document.write(s); } // --> </script> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> <!-- Kalendar(); // --> </SCRIPT> </BODY> </HTML>
[ Navrat / BACK ]