hmm mau buat kalender
aku punya nih sytac sederhana membuat kalender
hehehe
lihat di bawah ini ya :
<SCRIPT LANGUAGE="JavaScript">
namabulan = new Array(
"Januari",
"Februari",
"Maret",
"April",
"Mei",
"Juni",
"Juli",
"Agustus",
"September",
"Oktober",
"November",
"Desember");
var linkhitung=0;
function addlink(month, day, href) {
var masukan = new Array(3);
masukan[0] = month;
masukan[1] = day;
masukan[2] = href;
ini[linkhitung++] = masukan;
}
Array.prototype.addlink = addlink;
linkhari = new Array();
nbulan = new Array(12);
nbulan[0]=31;
nbulan[1]=28;
nbulan[2]=31;
nbulan[3]=30;
nbulan[4]=31;
nbulan[5]=30;
nbulan[6]=31;
nbulan[7]=31;
nbulan[8]=30;
nbulan[9]=31;
nbulan[10]=30;
nbulan[11]=31;
tanggalSekarang=new Date();
hari_ini=tanggalSekarang.getDay();
bulan_ini=tanggalSekarang.getMonth();
tanggal_ini=tanggalSekarang.getDate();
tahun_ini=tanggalSekarang.getYear();
tahun_ini = tahun_ini % 100;
tahun_ini = ((tahun_ini < 50) ? (2000 + tahun_ini) : (1900 + tahun_ini));
if (((tahun_ini % 4 == 0)
&& !(tahun_ini % 100 == 0))
||(tahun_ini % 400 == 0)) nbulan[1]++;
spasi=tanggal_ini;
while (spasi > 7) spasi-=7;
spasi = hari_ini - spasi + 1;
if (spasi < 0) spasi+=7;
document.write("<table border=0 cellpadding=2 cellspacing=2 width=220 height=150 align=left bgcolor=#A6CAE4>");
document.write("<tr><td colspan=7><center><font size=1 face=Verdana, Arial, Helvetica, sans-serif color = black>"
+ namabulan[bulan_ini] + " " + tahun_ini
+ "</center></font></td></tr>");
document.write("<tr>");
document.write("<td align=center bgcolor=#dedede><font size=1 face=Verdana, Arial, Helvetica, sans-serif color=red>M</font></td>");
document.write("<td align=center bgcolor=#dedede><font size=1 face=Verdana, Arial, Helvetica, sans-serif>S</font></td>");
document.write("<td align=center bgcolor=#dedede><font size=1 face=Verdana, Arial, Helvetica, sans-serif>S</font></td>");
document.write("<td align=center bgcolor=#dedede><font size=1 face=Verdana, Arial, Helvetica, sans-serif>R</font></td>");
document.write("<td align=center bgcolor=#dedede><font size=1 face=Verdana, Arial, Helvetica, sans-serif>K</font></td>");
document.write("<td align=center bgcolor=#dedede><font size=1 face=Verdana, Arial, Helvetica, sans-serif>J</font></td>");
document.write("<td align=center bgcolor=#dedede><font size=1 face=Verdana, Arial, Helvetica, sans-serif>S</font></td>");
document.write("</tr>");
document.write("<tr align=center>");
for (s=0;s<spasi;s++) {
document.write("<td align=center bgcolor=white><font size=1 face=Verdana, Arial, Helvetica, sans-serif></font> </td>");
}
hitung=1;
while (hitung <= nbulan[bulan_ini]) {
for (b = spasi;b<7;b++) {
linktrue=false;
document.write("<td align=center bgcolor=white><font size=1 face=Verdana, Arial, Helvetica, sans-serif>");
for (c=0;c<linkhari.length;c++) {
if (linkhari[c] != null) {
if ((linkhari[c][0]==bulan_ini + 1) && (linkhari[c][1]==hitung)) {
document.write("<a href=\"" + linkhari[c][2] + "\">");
linktrue=true;
}
}
}
if (hitung==tanggal_ini) {
document.write("<font color='#AFDA3B'><strong>");
}
if (hitung <= nbulan[bulan_ini]) {
document.write(hitung);
}
else {
document.write(" ");
}
if (hitung==tanggal_ini) {
document.write("</strong></font>");
}
if (linktrue)
document.write("</a>");
document.write("</font></td>");
hitung++;
}
document.write("</tr>");
document.write("<tr>");
spasi=0;
}
document.write("</table></p>");
</SCRIPT>
and this output :
Tidak ada komentar:
Posting Komentar