javascript版的日期输入控件
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="Microsoft FrontPage 5.0">
<META NAME="Author" CONTENT="zhaoweiwei">
<META NAME="Keywords" CONTENT="birthday_input">
<META NAME="Description" CONTENT="日起输入控件">
<script>
function showdb() file://显示控件/隐藏空间
{
var CurrentDate=new Date();
var CYear=CurrentDate.getFullYear();
var CMonth=CurrentDate.getMonth();
var CDay=CurrentDate.getDay();
var a=document.getElementById("input_birth");
var obj_year=document.getElementById("year"); file://当展开控件时自动取到当前时间(客户端)
obj_year.innerText=CYear;
var obj_month=document.getElementById("month");
obj_month.innerText=CMonth 1;
var s=new Date(CYear,CMonth,1);
var startDay=s.getDay(); file://日期起始数字 内容来自dedecms
var numDays=numberOfDays(CMonth,CYear); file://本月天数
var day=document.getElementsByName("day");
for(var j=1;j<=numDays;j ) file://插入日期
{
day[startDay j-1].innerText=j;
}
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://月
文章评论
共有位Admini5网友发表了评论 查看完整内容