javascript版的日期输入控件
{
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://月数减少 dedecms.com
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 ALIGN='CENTER'>" n "</H3>");
} 本文来自织梦
function add_day(year,month,day)
{
bd.birthdate.value=year "-" month "-" day;
}
</script>
</HEAD> copyright dedecms
<BODY>
<form name="bd">
<input type="text" name="birthdate" size="20" readOnly><input type="button" value="..." onclick="showdb()">
</form>
<div id="input_birth" name="input_birth" style="visibility:hidden; width:239; height:128">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" style="cursor:hand" bordercolor="#111111" width="100%" height="26">
<tr>
织梦内容管理系统
< td width="100%" colspan="3" height="26"> <input type="button" value="<<" onclick="plusyear()" name="plusyear">
<input type="button" value="<" onclick="plusmonth()" name="plusmonth"> <font id="year">
</font>年<font id="month"></font>月
<input type="button" value=">" onclick="addmonth()" name="addmonth">
<input type="button" value=">>" name="addyear" onclick="addyear()"></td>
</tr>
<tr>
<td width="100%" colspan="3" height="119" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%">
<tr>
<td width="14%" align="center"><b><font color="#FF0000">日</font></b></td>
<td width="14%" align="center"><b>一</b></td>
<td width="14%" align="center"><b>二</b></td>
dedecms.com
<td width="14%" align="center"><b>三</b></td>
文章评论
共有位Admini5网友发表了评论 查看完整内容