//生成日历
function Calendar()
{ newCal = new Date(year,month,1); //当前月的第一天
today = new getToday();
var day = -1; //用来判断日历中是否为当天
var startDay = newCal.getDay(); //当月开始时间
var endDay=getDays(newCal.getMonth(), newCal.getFullYear());//当月结束时间
var daily = 0; //用来生成日历中的天数值
if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))
day = today.day;
var caltable = document.all.caltable.tBodies.calendar; //得到日历表格的集合
var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear()); //得到当月天数
//生成日历
for (var intWeek = 0; intWeek < caltable.rows.length;intWeek++)
for (var intDay = 0;intDay < caltable.rows[intWeek].cells.length;intDay++)
{
var cell = caltable.rows[intWeek].cells[intDay]; //得到单元袼
//生成字符串用于判断当天是否有日志
var montemp=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1);
if ((intDay == startDay) && (0 == daily)){ daily = 1;}
var daytemp=daily<10?("0"+daily):(daily);
var d="<"+newCal.getFullYear()+"-"+montemp+"-"+daytemp+">";
//选择样式
if(day==daily)
cell.className="calendarNow";
else if(diarydays.indexOf(d)!=-1)
cell.className="calendarLink";
else if(intDay==6)
cell.className = "calendarDaySat";
else if (intDay==0)
cell.className ="calendarDaySun";
else
cell.className="calendarTd";
//生成值
if ((daily > 0) && (daily <= intDaysInMonth))
{ cell.innerText = daily;
daily++;
}
else
cell.innerText = "";
}
document.all.year.value=year;
document.all.month.value=month+1;
}
function subMonth()
{
if ((month-1)<0)
{
month=11;
year=year-1;
}
else
{
month=month-1;
}
Calendar();
}
function addMonth()
{
if((month+1)>11)
{
month=0;
year=year+1;
}
else
{
month=month+1;
}
Calendar();
}
//得到响应事件
function getDiary()
{
var mon=(newCal.getMonth()+1)<10?("0"+(newCal.getMonth()+1)):(newCal.getMonth()+1);
var day=event.srcElement.innerText<10?("0"+event.srcElement.innerText):(event.srcElement.innerText);
var d="<"+newCal.getFullYear()+"-"+mon+"-"+day+">";
if ("TD" == event.srcElement.tagName)
if (("" != event.srcElement.innerText)&&(diarydays.indexOf(d)!=-1))
{
diary.location="/foxmail/archive/"+newCal.getFullYear()+"/"+mon+"/"+day+".aspx";
window.location.href = diary.location;
}
}
function setDate()
{
if (document.all.month.value<1||document.all.month.value>12)
{
alert("月的有效范围在1-12之间!");
return;
}
year=Math.ceil(document.all.year.value);
month=Math.ceil(document.all.month.value-1);
Calendar();
}
</SCRIPT>
<table border="0" cellpadding="0" cellspacing="1" class="calendarBigBorder" id="caltable" width="200">
<thead>
<tr align="center" valign="middle">
<td colspan="7" class="calendarMonthTitle">
<input name="year" type="text" class="calendarYInput" size="3" maxlength="4" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')">年
<input name="month" type="text" class="calendarMInput" size="1" maxlength="2" onkeydown="if (event.keyCode==13){setDate()}" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onpaste="this.value=this.value.replace(/[^0-9]/g,'')">月 [<a onClick="addMonth()" href="javascript:;">下月</a>] [<a onClick="subMonth()" href="javascript:;">上月</a>]</td>
</tr>
<tr align="center" valign="middle">
<SCRIPT LANGUAGE="JavaScript">
document.write("<TD class=calendarDaySun id=diary>" + days[0] + "</TD>");
for (var intLoop = 1; intLoop < days.length-1;
intLoop++)
document.write("<TD class=calendarTd id=diary>" + days[intLoop] + "</TD>");
document.write("<TD class=calendarDaySat id=diary>" + days[intLoop] + "</TD>");
</SCRIPT>
</TR>
</thead>
<TBODY border=1 cellspacing="0" cellpadding="0" ID="calendar" ALIGN=CENTER ONCLICK="getDiary()" onmouseup=document.selection.empty() oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty() onselect=document.selection.empty()>
<SCRIPT LANGUAGE="JavaScript">
for (var intWeeks = 0; intWeeks < 6; intWeeks++) {
document.write("<TR style='cursor:hand'>");
for (var intDays = 0; intDays < days.length;intDays++)
document.write("<TD class=calendarTd onMouseover='{classTemp=this.className;this.className=calendarHover}' onMouseOut='this.className=classTemp'></TD>");
document.write("</TR>");
}
</SCRIPT>
</tbody>
</table>
<script LANGUAGE="JavaScript">
Calendar();
</script>
<!-- Blog日历表结束 -->
<!-- 天气预报 注意这里涉及到编码问题,%B1%B1%BE%A9为城市代码,可用百度查一下,比如输入北京,地址栏中就会出现%B1%B1%BE%字样的内容-->
<center><iframe width=157 height=240 frameborder=0 scrolling=NO src='http://appnews.qq.com/cgi-bin/news_qq_search?city=%B1%B1%BE%A9'></iframe></center>
<!-- 显示msn在线状态,注意:必须在msn中设置允许所有人查看你的状态才有效,否则msn图标永远发灰 -->
<A HREF="http://snind.gotdns.com:8080/message/msn/你的msn用户名">
<IMG SRC="http://snind.gotdns.com:8080/msn/你的msn用户名"
align="absmiddle" border="0" ALT="MSN Online Status Indicator"
onerror="this.onerror=null;this.src='http://snind.gotdns.com:8080/image/msnunknown.gif';">
<!-- QQ在线状态显示 -->
</A><br>QQ:你的号码<img src="http://icon.tencent.com/你的号码/l/612/">
本文地址:http://com.8s8s.com/it/it43023.htm