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() //显示控件/隐藏空间
{
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;
obj_year.innerText=parseInt(num_year)+1; //年数增加
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; //年数减少
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) //月数增加到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; //月数增加
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) //月数减少到1时,年数相应减少1,月数从12开始
{
obj_month.innerText="13";
相关新闻>>
- Javascript 兼容 IE6、IE7、FF 的“加入收藏”“设为首页”
- 好好学一遍JavaScript 笔记(一)——基础中的基础
- 好好学一遍JavaScript 笔记(二)——encode、数组、对象创建
- 好好学一遍JavaScript 笔记(三)——StringBuffer、prototype
- 好好学一遍javaScript 笔记(四)——Attribute、HTML元素、文档碎
- 好好学一遍JavaScript 笔记(五)——正则表达式基础
- 好好学一遍JavaScript 笔记(六)——正则表达式基础二
- 好好学一遍JavaScript 笔记(七)——RegExp对象与常用正则
- 好好学一遍JavaScript 笔记(八)——冒泡型事件、捕获型事件
- JavaScript详解
- 发表评论
-
- 最新评论 更多>>