不错的一个日期输入 动态

2019-06-03 17:10:04丽君

    OldTextBox.value=time;
    var parent=yy.parentNode;
    parent.insertBefore(OldTextBox,yy);
    parent.removeChild(yy);
    parent.removeChild(mm);
    parent.removeChild(d);
    parent.removeChild(btn);
}
function SetDay(year,month)
{
    if(year==null){
        var yy=document.getElementById('LoftyYear');
        var mm=document.getElementById('LoftyMonth');
        year=Math.round(yy.options[yy.selectedIndex].value);
        month=Math.round(mm.options[mm.selectedIndex].value);
    }
    var date=new Date(year,month,1);
    date.setDate(0);
    var maxdate=date.getDate();
    var obj=document.getElementById('LoftyDay');
    var seldate=obj.selectedIndex;
    if(obj.options.length>0){
        if(Math.round(obj.options[obj.selectedIndex].value)>maxdate)
        {
            seldate=maxdate-1;
        }
    }
        reAppendSelect(obj,1,maxdate,seldate+1);
}
function SetCurrentYear(selecter,currYear)
{
    if(currYear==null){
        currYear=Math.round(selecter.options[selecter.selectedIndex].value);
    }
    reAppendSelect(selecter,currYear-10,currYear+10,currYear);
}
function reAppendSelect(selecter,startIndex,endIndex,selIndex)
{
    while(selecter.options.length>0)
    {
        selecter.removeChild(selecter.options[selecter.options.length-1]);
    }
    for(i=startIndex;i<=endIndex;i++)
    {
        var op=new Option(i,i);
        selecter.options.add(op);
        op.selected=(selIndex==i);
    }
}
function al(obj,lissener,func){
    if(agt.indexOf('firefox')!=-1){
        obj.addEventListener(lissener,function(){eval(func);},false);
    }else{
        obj.attachEvent('on'+lissener,function(){eval(func);});