js 시간 플러그 인 가 져 오기

12829 단어 js
Calendar.js:

/**
 *        tiannet          。       meizz     。
 *tiannet         、select,object      ,       。
 *    :
 * (1)        
 * (2)         
 * (3)           
 *       
 * (1)           setDateSplit(strSplit);   "-"
 * (2)               setDateTimeSplit(strSplit);   " "
 * (3)           setTimeSplit(strSplit);   ":"
 * (4)  (1),(2),(3)       setSplit(strDateSplit,strDateTimeSplit,strTimeSplit);
 * (5)             setYearPeriod(intDateBeg,intDateEnd)
 *  :
 *              :2005-02-02 08:08
 */
//------------------      ---------------------------//
//        
var s_tiannet_turn_base = "height:16px;font-size:9pt;color:white;border:0 solid #CCCCCC;cursor:hand;background-color:#2650A6;";
//  、     
var s_tiannet_turn = "width:28px;" + s_tiannet_turn_base;
//  、       
var s_tiannet_turn2 = "width:22px;" + s_tiannet_turn_base;
//      
var s_tiannet_select = "width:64px;display:none;";
// 、 、      
var s_tiannet_select2 = "width:46px;display:none;";
//          
var s_tiannet_body = "width:150;background-color:#2650A6;display:none;z-index:9998;position:absolute;" +
  "border-left:1 solid #CCCCCC;border-top:1 solid #CCCCCC;border-right:1 solid #999999;border-bottom:1 solid #999999;";
//    td   
var s_tiannet_day = "width:21px;height:20px;background-color:#D8F0FC;font-size:10pt;";
//    
var s_tiannet_font = "color:#FFCC00;font-size:9pt;cursor:hand;";
//     
var s_tiannet_link = "text-decoration:none;font-size:9pt;color:#2650A6;";
//  
var s_tiannet_line = "border-bottom:1 solid #6699CC";
//------------------      ---------------------------//
var tiannetYearSt = 1950;//        
var tiannetYearEnd = 2010;//        
var tiannetDateNow = new Date();
var tiannetYear = tiannetDateNow.getFullYear(); //          
var tiannetMonth = tiannetDateNow.getMonth()+1; //          
var tiannetDay = tiannetDateNow.getDate();
var tiannetHour = 8;//tiannetDateNow.getHours();
var tiannetMinute = 0;//tiannetDateNow.getMinutes();
var tiannetArrDay=new Array(42);          //        
var tiannetDateSplit = "-";     //       
var tiannetDateTimeSplit = " ";    //           
var tiannetTimeSplit = ":";     //       
var tiannetOutObject;      //         
var arrTiannetHide = new Array();//        
var m_bolShowHour = false;//      
var m_bolShowMinute = false;//      

var m_aMonHead = new Array(12);         //             
    m_aMonHead[0] = 31; m_aMonHead[1] = 28; m_aMonHead[2] = 31; m_aMonHead[3] = 30; m_aMonHead[4]  = 31; m_aMonHead[5]  = 30;
    m_aMonHead[6] = 31; m_aMonHead[7] = 31; m_aMonHead[8] = 30; m_aMonHead[9] = 31; m_aMonHead[10] = 30; m_aMonHead[11] = 31;
// ----------------------          -----------------------------//
//      -     
function setDay(obj){
 tiannetOutObject = obj;
 //       ,           
 var strValue = tiannetTrim(tiannetOutObject.value);
 if( strValue != "" ){
  tiannetInitDate(strValue);
 }
 tiannetPopCalendar();
}
//      -       
function setDayH(obj){
 tiannetOutObject = obj;
 m_bolShowHour = true;
 //       ,              
 var strValue = tiannetTrim(tiannetOutObject.value);
 if( strValue != "" ){
  tiannetInitDate(strValue.substring(0,10));
  var hour = strValue.substring(11,13);
  if( hour ');
document.write('');
document.write('  ');
document.write('');
for(var i=tiannetYearSt;i ' + i + ' ');
}
document.write('');
document.write('   ');
document.write('');
for(var i=1;i ' + i + ' ');
}
document.write('');
//document.write('');
//document.write('');
document.write('  ');
document.write('');
for(var i=0;i ' + i + ' ');
}
document.write('');
document.write('   ');
document.write('');
for(var i=0;i ' + i + ' ');
}
document.write('');
document.write('');
//      
document.write('');
document.write('');
document.write('');
document.write(' ');
document.write('');
document.write('');
document.write('');
//      
document.write('');
document.write('');
document.write(' ');
for(var i =0;i ' + weekName[i] + '');
}
document.write(' ');
document.write('');
//      
document.write('');
var n = 0;
for (var i=0;i');
 for (var j=0;j ');
  n ++;
 }
 document.write (' ');
}
document.write (' ');
document.write(' ');
document.write(' ');
document.write('  '+
    '   ' +
    '    ' +
    '');
document.write (' ');
document.write('');
document.write('');
//------------------ end        ---------------------------//
//------------------        span       ---------------------------//
//    span    
function spanYearCEvent(){
 hideElementsById(new Array("selTianYear","tiannetMonthHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("tiannetHourHead"),false);
 if(m_bolShowMinute) hideElementsById(new Array("tiannetMinuteHead"),false);
 hideElementsById(new Array("tiannetYearHead","selTianMonth","selTianHour","selTianMinute"),true);
}
//    span    
function spanMonthCEvent(){
 hideElementsById(new Array("selTianMonth","tiannetYearHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("tiannetHourHead"),false);
 if(m_bolShowMinute) hideElementsById(new Array("tiannetMinuteHead"),false);
 hideElementsById(new Array("tiannetMonthHead","selTianYear","selTianHour","selTianMinute"),true);
}
//    span    
function spanHourCEvent(){
 hideElementsById(new Array("tiannetYearHead","tiannetMonthHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("selTianHour"),false);
 if(m_bolShowMinute) hideElementsById(new Array("tiannetMinuteHead"),false);
 hideElementsById(new Array("tiannetHourHead","selTianYear","selTianMonth","selTianMinute"),true);
}
//    span    
function spanMinuteCEvent(){
 hideElementsById(new Array("tiannetYearHead","tiannetMonthHead"),false);
 if(m_bolShowHour) hideElementsById(new Array("tiannetHourHead"),false);
 if(m_bolShowMinute) hideElementsById(new Array("selTianMinute"),false);
 hideElementsById(new Array("tiannetMinuteHead","selTianYear","selTianMonth","selTianHour"),true);
}
//    id       
function hideElementsById(arrId,bolHide){
 var strDisplay = "";
 if(bolHide) strDisplay = "none";
 for(var i = 0;i  getMonthCount(tiannetYear,tiannetMonth) ) {
  //              ,       
  tiannetDay = getMonthCount(tiannetYear,tiannetMonth);
 }
}
//       
function addZero(value){
 if(value  999 && tiannetYear  999 && tiannetYear  tiannetYearEnd ) {
  tiannetYearEnd = tiannetYear;
  createOption(document.all.selTianYear,tiannetYear,tiannetYear + " ");
 }
 checkSelect(document.all.selTianYear,tiannetYear);
 tiannetWriteHead();
}
//    
function tiannetToday() {
 tiannetYear = tiannetDateNow.getFullYear();
 tiannetMonth = tiannetDateNow.getMonth()+1;
 tiannetDay = tiannetDateNow.getDate();
 tiannetSetValue(true);
 //tiannetSetDay(tiannetYear,tiannetMonth);
 //selectObject();
}
//     
function tiannetPrevMonth() {
 if(tiannetMonth>1){tiannetMonth--}else{tiannetYear--;tiannetMonth=12;}
 tiannetSetDay(tiannetYear,tiannetMonth);
 checkSelect(document.all.selTianMonth,tiannetMonth);
 tiannetWriteHead();
}
//     
function tiannetNextMonth() {
 if(tiannetMonth==12){tiannetYear++;tiannetMonth=1}else{tiannetMonth++}
 tiannetSetDay(tiannetYear,tiannetMonth);
 checkSelect(document.all.selTianMonth,tiannetMonth);
 tiannetWriteHead();
}
// span      、 、 、    
function tiannetWriteHead(){
 document.all.tiannetYearHead.innerText = tiannetYear + " ";
 document.all.tiannetMonthHead.innerText = tiannetMonth + " ";
 if( m_bolShowHour )  document.all.tiannetHourHead.innerText = " "+tiannetHour + " ";
 if( m_bolShowMinute ) document.all.tiannetMinuteHead.innerText = tiannetMinute + " ";
 tiannetSetValue(false);//      ,       
}
//     
function tiannetSetDay(yy,mm) {
  
 setRealDayCount();//        
 tiannetWriteHead();
 var strDateFont1 = "", strDateFont2 = "" //         
 for (var i = 0; i "
   strDateFont2 = ""
   } else {
    strDateFont1 = "";
    strDateFont2 = ""
   }
   da.innerHTML = strDateFont1 + tiannetArrDay[i] + strDateFont2;
   //         ,     
   if(tiannetArrDay[i] == tiannetDay ) {
    da.style.backgroundColor = "#CCCCCC";
   } else {
    da.style.backgroundColor = "#EFEFEF";
   }
   da.style.cursor="hand"
  } else {
   da.innerHTML="";da.style.backgroundColor="";da.style.cursor="default"
  }
 }//end for
 tiannetSetValue(false);//      ,       
}//end function tiannetSetDay
//  option    option
function checkSelect(objSelect,selectValue) {
 var count = parseInt(objSelect.length);
 if( selectValue  tiannetYearEnd ) {
  for( var i = tiannetYearEnd+1;i  document.body.offsetWidth - 10    )
  iX = window.event.x - h - 5 ;
 else
  iX = window.event.x + 5;  
 if (iX  document.body.offsetHeight - 10   )
  iY = document.body.scrollTop + document.body.offsetHeight - w - 5 ;
 else
  iY = document.body.scrollTop +window.event.y + 5;  
 if (iY  x && (y + h + 20) > objTop && (objTop+objHeight) >  y && objLeft 


a.html:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
    <head>
        <title></title>
        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
        <meta name="ProgId" content="VisualStudio.HTML">
        <meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
        <script src="./Calendar.js"></script>
    </head>
    <body>
        (1)        <input type="text" name="date"   readOnly onClick="setDay(this);"><br/>
(2)         <input type="text" name="dateh"  readOnly onClick="setDayH(this);"><br/>
(3)           <input type="text" name="datehm" readOnly onClick="setDayHM(this);">

    </body>
</html>

좋은 웹페이지 즐겨찾기