if(a.style.visibility=='visible')
{
a.style.visibility='hidden';
}
else
{
a.style.visibility='visible';
}
}
function addyear()
{
var obj_year=document.getElementById("year");
var obj_month=document.getElementById("month");
var num_year=obj_year.innerText;
obj_year.innerText=parseInt(num_year)+1; file://年数增加
displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function plusyear()
{
var obj_year=document.getElementById("year");
var obj_month=document.getElementById("month");
var num_year=obj_year.innerText;
obj_year.innerText=parseInt(num_year)-1; file://年数减少
displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function addmonth()
{
var obj_month=document.getElementById("month");
var obj_year=document.getElementById("year");
if(parseInt(obj_month.innerText)>=12) file://月数增加到12时,年数相应增加1,月数从1开始
{
obj_month.innerText="0";
obj_year=document.getElementById("year");
var num_year=obj_year.innerText;
obj_year.innerText=parseInt(num_year)+1;
}
var num_month=obj_month.innerText;
obj_month.innerText=parseInt(num_month)+1; file://月数增加
displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function plusmonth()
{
var obj_month=document.getElementById("month");
var obj_year=document.getElementById("year");
if(parseInt(obj_month.innerText)<=1) file://月数减少到1时,年数相应减少1,月数从12开始
{
obj_month.innerText="13";
obj_year=document.getElementById("year");
var num_year=obj_year.innerText;
obj_year.innerText=parseInt(num_year)-1;
}
var num_month=obj_month.innerText;
obj_month.innerText=parseInt(num_month)-1; file://月数减少
displayCalendar(obj_month.innerText-1,obj_year.innerText);
}
function numberOfDays(month,year) file://取得每月天数,判断平年闰年
{
var numDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
n=numDays[month];
if(month==1&&year%4==0) ++n;
return n;
}
function displayCalendar(month,year)
{
var d=new Date(year,month,1);
var startDay=d.getDay(); file://日期起始数字
var numDays=numberOfDays(month,year); file://本月天数
var day=document.getElementsByName("day");
for(var i=0;i<day.length;i++)
{
day[i].innerText="";
}
for(var j=1;j<=numDays;j++) file://插入日期
{
day[startDay+j-1].innerText=j;
}
}
function writeDate(n)
{
document.writeln("<H3>"+n+"</H3>");
}
function add_day(year,month,day)
{
bd.birthdate.value=year+"-"+month+"-"+day;
}
</script>
</HEAD>
<BODY>
<form>
<input type="text" size="20" readOnly><input type="button" value="..." >
</form>
<div>
<table cellpadding="0" cellspacing="0" bordercolor="#111111" >
<tr>
< td colspan="3"> <input type="button" value="<<">
<input type="button" value="<"> <font>
</font>年<font></font>月
<input type="button" value=">">
<input type="button" value=">>" ></td>
</tr>
<tr>
<td colspan="3" valign="top">
<table cellpadding="0" cellspacing="0" bordercolor="#111111">
<tr>
<td><b><font color="#FF0000">日</font></b></td>
<td><b>一</b></td>
<td><b>二</b></td>
<td><b>三</b></td>
<td><b>四</b></td>
<td><b>五</b></td>
<td><b><font color="#FF0000">六</font></b></td>
</tr>
<tr>
<td ></td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
<tr>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
<td > </td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</BODY>
</HTML>