　　    function initDate(year,month,day)
　　    {
            //每个月的初始天数
　　        MonDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
　　        //当前的年份
　　        var y = new Date().getFullYear()-40;
			var cy= new Date().getFullYear();
　　        //当前的月份
　　        var m = new Date().getMonth()+1; //javascript月份为0-11
　　        //但前的天份
　　        var d = new Date().getDate();
    　　    
            //以今年为准，向后2年，填充年份下拉框
　　        for (var i = y; i < (y+40); i++)
            {
　　            year.options.add(new Option(i,i));
				
            }
            //选中今年
            year.value="";

　　        //填充月份下拉框
　　        for (var i = 1; i <= 12; i++)
            {
                month.options.add(new Option(i,i));				
            }
            //选中当月
            month.value ="";
                
            //获得当月的初始化天数
            var n = MonDays[m-1];
            //如果为2月，天数加1
            if (m == 2 && isLeapYear(year.options[year.selectedIndex].value))
                  n++;
            //填充日期下拉框
            createDay(n,day); 
            //选中当日
            day.value = "";
　　    }

	function setyear(year,y) 
	{	for(i=0; i<year.options.length; i++)
		{
		if(year.options[i].value == y)
					{
						year.options[i].selected =true;
					}
		}
	}
	function setmonth(month,m) 
	{
		for(j=0; j<month.options.length; j++)
		{
		if(month.options[j].value == m)
					{
						month.options[j].selected =true;
					}
		}
	}
	function setday(day,d) 
	{	for(l=0; l<day.options.length; l++)
		{
		if(day.options[l].value == d)
					{
						day.options[l].selected =true;
					}
		}
	}

　　    function change(year,month,day) //年月变化，改变日
　　    {   
			 var y = year.options[year.selectedIndex].value;
    　　     var m = month.options[month.selectedIndex].value;
    　　     //if (m == "" ){  clearOptions(day); return;}
    　　     var n = MonDays[m - 1];
    　　     if ( m ==2 && isLeapYear(y))
    　　     {
    　　         n++;
    　　     }
    　　     createDay(n,day)
			
　　    }

    　
　　    function createDay(n,day) //填充日期下拉框
　　    {
　　        //清空下拉框
    　　     clearOptions(day);
    　　     //几天，就写入几项
    　　     for(var i=1; i<=n; i++)
    　　     {
    　　        day.options.add(new Option(i,i));
    　　     }
　　    }

        function clearOptions(ctl)//删除下拉框中的所有选项
　　    {
            for(var i=ctl.options.length-1; i>=0; i--)
            {
　　            ctl.remove(i);
　　        }
　　    }
    　　
　　    function isLeapYear(year)//判断是否闰年
　　    { 
　　        return( year%4==0 || (year%100 ==0 && year%400 == 0));
　　    }


