javascript版的日期输入控件(1),javascript版的日期输入控件(1)
【 tulaoshi.com - Javascript 】
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
<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() //显示控件/隐藏空间
{
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"); //当展开控件时自动取到当前时间(客户端)
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(); //日期起始数字
var numDays=numberOfDays(CMonth,CYear); //本月天数
var day=document.getElementsByName("day");
for(var j=1;j<=numDays;j++) //插入日期
{
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;
来源:http://www.tulaoshi.com/n/20160129/1483183.html
看过《javascript版的日期输入控件(1)》的人还看了以下文章 更多>>