t
Sunday, April 06, 2025
Javascript Calendar
tt
function setStyle(id,style,value)
{
id.style[style] = value;
}
function opacity(el,opacity)
{
setStyle(el,"filter:","alpha(opacity="+opacity+")");
setStyle(el,"-moz-opacity",opacity/100);
setStyle(el,"-khtml-opacity",opacity/100);
setStyle(el,"opacity",opacity/100);
}
function calendar()
{
var date = new Date();
var day = date.getDate();
var month = date.getMonth();
var year = date.getYear();
if(year<=200)
{
year += 1900;
}
months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December');
days_in_month = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if(year%4 == 0 && year!=1900)
{
days_in_month[1]=29;
}
total = days_in_month[month];
var date_today = day+' '+months[month]+' '+year;
beg_j = date;
beg_j.setDate(1);
if(beg_j.getDate()==2)
{
beg_j=setDate(0);
}
beg_j = beg_j.getDay();
document.write('');
document.write('');
week = 0;
for(i=1;i<=beg_j;i++)
{
document.write('');
week++;
}
for(i=1;i<=total;i++)
{
if(week==0)
{
document.write('');
}
if(day==i)
{
document.write('');
}
else
{
document.write('');
}
week++;
if(week==7)
{
document.write('');
week=0;
}
}
for(i=1;week!=0;i++)
{
document.write('');
week++;
if(week==7)
{
document.write('');
week=0;
}
}
document.write('
');
opacity(document.getElementById('cal_body'),70);
return true;
}
'+date_today+' | ||||||
---|---|---|---|---|---|---|
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
'+(days_in_month[month-1]-beg_j+i)+' | ||||||
'+i+' | '+i+' | |||||
'+i+' |