...

View Full Version : Calendars Using table



nusstu
05-24-2005, 02:15 PM
Hi,

I wanna create a calendar of past entries for my webloag. However, to do this for every month is cumbersome as I've to manually change the calendar's (table) <td> values one at a time.

Is there a way to automatically generate the table of calendar?

The calendar is something like: http://www.appdevadvisor.co.uk/blogs/weblog.php?id=M200504

Thanks

PcMan
05-24-2005, 04:48 PM
Hokay try this my friend!



<html>
<head>
<title>Calendar</title>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Calender 1900 - 2100</title>
<script language="JavaScript">
function show()
{
var md,sd,m,y;
var mname=new Array(12);
mname[0]="Jan";
mname[1]="Feb";
mname[2]="Mar";
mname[3]="Apr";
mname[4]="May";
mname[5]="Jun";
mname[6]="Jul";
mname[7]="Aug";
mname[8]="Sep";
mname[9]="Oct";
mname[10]="Nov";
mname[11]="Dec";
m=parseInt(document.form1.month.value)+1;
y=parseInt(document.form1.year.value);
alert(y);
if(m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12)
md=31;
else
if(m==4 || m==6 || m==9 || m==11)
md=30;
else
if(y % 4 == 0)
md=29;
else
md=28;
var x=new Date();
cday=x.getDate();
x.setMonth(m-1);
x.setYear(y);
x.setDate(1);
document.write("<h2><font color=black>" + mname[m-1] + "," + y + "</font></h2>");
document.write("<table border=3>");
document.write("<tr>");
document.write("<td>Sun</td>");
document.write("<td>Mon</td>");
document.write("<td>Tue</td>");
document.write("<td>Wed</td>");
document.write("<td>Thu</td>");
document.write("<td>Fri</td>");
document.write("<td>Sat</td>");
document.write("</tr>");
document.write("<tr>");
for(i=1;i<=sd;i++)
{
document.write("<td></td>");
}
for(i=1;i<=7-sd;i++)
{
document.write("<td>" + i + "</td>");
}
document.write("</tr>");
for(j=1;j<=5;j++)
{
document.write("<tr>");
for(k=1;k<=7;k++)
{
if(i>md)
break;
if(i==cday)
document.write("<td bgcolor='#FFFF00'>" + i + "</td>");
else
document.write("<td>" + i + "</td>");
i++;
}
document.write("</tr>");
}
document.write("</table>");
}
</script>
</head>
<body bgcolor="#FFFFFF">
<form method="POST" action="--WEBBOT-SELF--" name="form1" onSubmit="location.href='../_derived/nortbots.htm';return false;" webbot-onSubmit>
<!--webbot bot="SaveResults" u-file="\\hannibal\sem-iv\_private\form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan i-checksum="43374" -->
<div align="center">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" width="30%" id="AutoNumber1" bgcolor="#FFFFFF">
<tr>
<td width="15%">Month</td>
<td width="18%">
<select size="1" name="month">
<option value="0">January</option>
<option value="1">Feb</option>
<option value="2">Mar</option>
<option value="3">Apr</option>
<option value="4">May</option>
<option value="5">Jun</option>
<option value="6">Jul</option>
<option value="7">Aug</option>
<option value="8">Sep</option>
<option value="9">Oct</option>
<option value="10">Nov</option>
<option value="11">Dec</option>
</select>Year</td>
<td width="10%">
<select size="1" name="year">
<script language="JavaScript">
for(i=1900;i<=2100;i++)
{
document.write("<option value=" + i + ">" + i + "</option>");
}
</script>
</select></td>
</tr>
<tr>
<td width="15%">&nbsp;</td>
<td width="53%" colspan="2">
<input type="button" value="Show Calendar" onClick="show()" name="B1"></td>
</tr>
</table>
</div></form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Created by <a href="http://www.optamumpc.com">OptamumPC.com</a></p>
</body>
</html>

You can modify it if you like but please leave the link to OptamumPC.com. Just to help me out a little.

Thanks, and hope it was helpful for you!

nusstu
05-27-2005, 09:45 AM
Thanks, but it doesn't seem to work in Firefox.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum