[会员中心]    [设为主页][加入收藏][发布文章]  [中文繁體]
电脑
软件
手机
软件
网站
源码
文章
资料
    文 章 搜 索
[选项]
    推 荐 文 章       More...
华硕易电脑(ASUS Eee PC 1025C)驱动程序(Windows XP)安装参考(图) 华硕易电脑(ASUS Eee PC 1025C..
  先来段开场白:为了外出携..
Acronis True Image 使用说明 Acronis True Image 使用说明
  一款可以在Windows下使用..
Norton Ghost 使用详解 Norton Ghost 使用详解
一、分区备份   使用Ghost..
Windows 2000/XP/2003 系统封装参考及工具 Windows 2000/XP/2003 系统封..
  一直以来,安装操作系统和..
    阅 读 排 行
Intel GMA 3600 V1.15 for Windows XP 驱动程序配置过程图解 Intel GMA 3600 V1.15 for Window..
Intel GMA 3600 V1.15 for Window..
夏普(SHARP) AR-1808S 以 A4 尺寸纸张扫描 夏普(SHARP) AR-1808S 以 A4 尺..
  新装的夏普(SHARP) AR-1808S..
中国电信的家庭宽带设置“端口映射”及获取公网IP地址 中国电信的家庭宽带设置“端口映..
  现在有些家庭/店铺安装了视..
路由器串联(路由器的分支再接一个路由器) 路由器串联(路由器的分支再接一..
  问题:路由器的分支再接一个..
XHTML 中 a 标签 target 属性失效的解决方法 XHTML 中 a 标签 target 属性失..
  在HTML 4.01/XHTML 1.0/XHTML..
19寸液晶显示器更换显卡后没有分辨率 1440*900 19寸液晶显示器更换显卡后没有分..
  宿舍的电脑更换显卡后,驱动..
申请/注销/关闭腾讯QQ空间 申请/注销/关闭腾讯QQ空间
  申请/注销/关闭腾讯QQ空间网..
电脑机箱(主板)前面板 USB 数据线的接线参考(图) 电脑机箱(主板)前面板 USB 数据..
  一、概述   因为每个 US..
  文 章 信 息
    JavaScript 日期选择功能 五
[留言][评论][收藏]
[文章分类:电脑系统/网络/HTML/CSS/JavaScript][字体:隶体/楷体/宋体/黑体][字号:12px/14px/16px/18px][颜色:] 
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
td {
        font-family: "Arial", "Helvetica", "sans-serif";
        font-size: 12px;
        color: #000000;
}
-->
</style>

</head>

<body>
<table width="60%" border="0" cellspacing="6" cellpadding="0">
  <tr>
    <td width="25%"> </td>
    <td width="75%"> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td><form name="form1" method="post" action="">
        <script>
/* alin */
/* Email:[email protected] */
/* QQ:38062022 */
/* Creation date: 2004-6-13 */
        var myC_x,myC_y;
        var myC_timeset=null,myC_timeset1=null;
        var divObj=null;
        var inputName;
        function myCalendar()  //构建对象
            {
             var myDate = new Date();               
                 this.year = myDate.getFullYear();
                 this.month = myDate.getMonth()+1;
                 this.date = myDate.getDate();
                       
                 this.format="yyyy-mm-dd";        
                 this.style = myStyle(1); 
                 this.show = createCalendar;
                 this.input = createInput;
                }
               
        function myStyle(num) //设置样式
            {
                  if(!num||isNaN(num)){alert('参数不对,采用默认样式!');num=1;}
                 var style = new Array();
                     
                  style[1]=".week{background-color:#DfDfff;font-size:12px;width:140px;}"
                           +".ds{width:140px;font-size:12px;cursor:hand}"
                                   +".mover{border:1px solid black;background-color:#f4f4f4;}"
                                   +".move1{border:1px solid #5d5d5d;background-color:#f4f4f4;color:#909eff;font-size:12px}"
                                                                                            +".tit{background-color:#909EFF;width:140px;font-size:12px;color:white;cursor:default}"
                                   +".cs{position:absolute;border:1px solid #909eff;width:142px;z-index:9999;}"
                                   +".shadow{position:absolute;font-family: Arial Black;font-size:50px;color:#d4d4d4;z-index:1;text-align:center;}";
                                         
                  document.write("<style type='text/css'>");                 
                  document.write(style[num]);                 
                  document.write("</style>");
                }
               
        function createCalendar()
            {
                var week = new Array('日','一','二','三','四','五','六');
               
                document.write("<div class='cs' onselectstart='return false' oncontextmenu='return false' onmousedown='if(event.button==2)this.style.display=\"none\"' id='myC_div'><div class='shadow'></div><div style='position:absolute;z-index:1'>");
                //创建头部
                document.write("<table class='tit' id='myC_Top' onmousedown='myC_x=event.x-parentNode.parentNode.style.pixelLeft;myC_y=event.y-parentNode.parentNode.style.pixelTop;setCapture()' onmouseup='releaseCapture();' onmousemove='myCMove(this.parentElement.parentElement);'><tr><td width=10 onmouseover='this.style.color=\"black\"' onmouseout='this.style.color=\"\"' onclick='cutYear()' style='font-family: Webdings;cursor:hand;' title='减少年份'>7</td><td title='减少月份' onmouseover='this.style.color=\"black\"' onclick='cutMonth()' onmouseout='this.style.color=\"\"' width=10 style='font-family: Webdings;cursor:hand;'>3</td><td align=center onmouseover=this.className='move1'; onmouseout=this.className='';divHidden(myC.parentElement.nextSibling); onclick='createyear("+this.year+",this);divShow(myC.parentElement.nextSibling);'></td><td align=center onclick='createmonth("+this.month+",this);divShow(myC.parentElement.nextSibling)' onmouseover=this.className='move1'; onmouseout=this.className='';divHidden(myC.parentElement.nextSibling);></td><td width=10 onmouseover='this.style.color=\"black\"' onmouseout='this.style.color=\"\"' onclick='addMonth()' style='font-family: Webdings;cursor:hand;' title='增加月份'>4</td><td width=10 style='font-family: Webdings;cursor:hand;' onmouseover='this.style.color=\"black\"' onmouseout='this.style.color=\"\"' onclick='addYear()' title='增加年份'>8</td></tr></table>");
      
                //创建星期条目
                 document.write("<table class='week'><tr>");
                   for(i=0;i<7;i++)
                     document.write("<td align=center>"+week[i]+"</td>");                        
                 document.write("</tr></table>");
                //创建日期条目
                 document.write("<table class='ds' id='myC' cellspacing=2 cellpadding=0>");
                   for(i=0;i<6;i++)
                     {
                          document.write("<tr>");
                          for(j=0;j<7;j++)
                            document.write("<td width=10% height=16 align=center onmouseover='mOver(this)' onmouseout='mOut(this)' onclick='if(this.innerText!=\"\")getValue(inputName,this.innerText);myC_div.style.display=\"none\"'></td>");
                          document.write("</tr>");
                         }
                 document.write("</table>");
                
                 //建建水印
                 document.write("</div>");
                 //创建选择图层
                 document.write("<div style='position:absolute;z-index:3' onmouseover=divShow(this) onmouseout=divHidden(this)></div>");                
                document.write("</div>");
               
               
                 //显示日期
                 showDate(this.year,this.month);       
                 myC_div.style.display='none';        
                }
               
        function getValue(obj,value)
             {
                  eval(obj).value=parseInt(myC_Top.cells[2].innerText)+"-"+parseInt(myC_Top.cells[3].innerText)+"-"+value;
                 }       
        function showDate(year,month)
            {
                  var myDate = new Date(year,month-1,1);
                  var today = new Date();
                  var day = myDate.getDay();
                  var length = new Array(31,30,31,30,31,30,31,31,30,31,30,31);
                      length[1] = ((year%4==0)&&(year%100!=0)||(year%400==0))?29:28;
                  
                   for(i=0;i<myC.cells.length;i++)myC.cells[i].innerHTML = "";
                  
                   for(i=0;i<length[month-1];i++)
                     {
                          myC.cells[i+day].innerHTML = (i+1);
                           if(new Date(year,month-1,i+1).getDay()==6||new Date(year,month-1,i+1).getDay()==0){myC.cells[i+day].style.color='red';}
                           }
                          
                        myC_Top.cells[2].innerText=year+"年";
                        myC_Top.cells[3].innerText=month+"月";
                       
                        with(myC.parentNode.previousSibling.style)
                          {
                           pixelLeft=myC.offsetLeft;
                           pixelTop=myC.offsetTop;
                           height = myC.clientHeight;
                           width = myC.clientWidth;
                          }
                  myC.parentElement.parentElement.style.height=myC.parentElement.offsetHeight;
                  myC.parentElement.previousSibling.innerHTML=year;
                }
               
        //一些附加函数--------------------
        //---------Begin-------------------
        function mOver(obj){obj.className = 'mover';}
        function mOut(obj){if(obj.className=='mover')obj.className = '';}         
        function addYear(){var year = parseInt(myC_Top.cells[2].innerText);var month = parseInt(myC_Top.cells[3].innerText); year++;showDate(year,month);}
        function addMonth(){var year = parseInt(myC_Top.cells[2].innerText);var month = parseInt(myC_Top.cells[3].innerText);month++;if(month>12){month=1;year++;}showDate(year,month);}
        function cutYear(){var year = parseInt(myC_Top.cells[2].innerText);var month = parseInt(myC_Top.cells[3].innerText);year--;showDate(year,month);}
        function cutMonth(){var year = parseInt(myC_Top.cells[2].innerText);var month = parseInt(myC_Top.cells[3].innerText);month--;if(month<1){month=12;year--;}showDate(year,month);}
    function divS(obj)
            {
                if(obj!=divObj)
                  {
                  obj.style.backgroundColor="#909eff";
                   obj.style.color='black';
                   }       
                 if(divObj!=null)
                 {
                 divObj.style.backgroundColor='';
                 divObj.style.color='';
                 }       
                 divObj = obj;               
                }
               
        function divShow(obj)
        {  if (myC_timeset!=null) clearTimeout(myC_timeset);
              obj.style.display='block';
     }
        function divHidden(obj){myC_timeset=window.setTimeout(function(){obj.style.display='none'},500);}
        function createyear(year,obj)//创建年份选择
           {
            var ystr;
                var oDiv;
                  ystr="<table class='move1' cellspacing=0 cellpadding=2 width="+obj.offsetWidth+">";
                  ystr+="<tr><td style='cursor:hand' onclick='createyear("+(year-10)+",myC_Top.cells[2])' align=center>上翻</td></tr>";
              for(i=year-5;i<year+5;i++)
                    if(year==i)
                         ystr+="<tr style='background-color:#909eff'><td style='color:black;height:16px;cursor:hand' align=center onclick='myC_Top.cells[2].innerText=this.innerText;showDate("+i+",parseInt(myC_Top.cells[3].innerText));myC.parentElement.nextSibling.innerHTML=\"\"'>"+i+"年</td></tr>";
                        else
                         ystr+="<tr><td align=center style='cursor:hand'  onmouseover=divS(this) onclick='myC_Top.cells[2].innerText=this.innerText;showDate("+i+",parseInt(myC_Top.cells[3].innerText));myC.parentElement.nextSibling.innerHTML=\"\"'>"+i+"年</td></tr>";
          ystr+="<tr><td style='cursor:hand' onclick='createyear("+(year+10)+",myC_Top.cells[2])' align=center>下翻</td></tr>";
                  ystr+="</table>";
                 
                  oDiv = myC.parentElement.nextSibling;
                         oDiv.innerHTML='';
                         oDiv.innerHTML = ystr;
                 
                  showDiv(oDiv,obj.offsetTop+obj.offsetHeight,obj.offsetLeft);
           }
        function createmonth(month,obj)//创建月份选择
           {
           var mstr;
           var oDiv;
                 mstr="<table class='move1' cellspacing=0 cellpadding=2 width="+obj.offsetWidth+">";
              for(i=1;i<13;i++)
                    if (month==i)
                         mstr+="<tr style='background-color:#909eff'><td style='color:black;height:16px;cursor:hand' align=center onclick='myC_Top.cells[3].innerText=this.innerText;showDate(parseInt(myC_Top.cells[2].innerText),"+i+");myC.parentElement.nextSibling.innerHTML=\"\"'>"+i+"月</td></tr>";
                        else
                     mstr+="<tr><td align=center style='cursor:hand' onmouseover='divS(this)' onclick='myC_Top.cells[3].innerText=this.innerText;showDate(parseInt(myC_Top.cells[2].innerText),"+i+");myC.parentElement.nextSibling.innerHTML=\"\"'>"+i+"月</td></tr>";
                  mstr+="</table>";
                   oDiv = myC.parentElement.nextSibling;
                          oDiv.innerHTML='';
                          oDiv.innerHTML = mstr;
                 showDiv(oDiv,obj.offsetTop+obj.offsetHeight,obj.offsetLeft); 
                  }
                 
    function showDiv(obj,top,left)
              {
                    obj.style.pixelTop=top;
                        obj.style.pixelLeft=left;
                }
    function myCMove(obj)
     {
         if(event.button==1)
          {
          var X = obj.clientLeft;
          var Y = obj.clientTop;
          obj.style.pixelLeft= X+(event.x-myC_x);
          obj.style.pixelTop= Y+(event.y-myC_y);
          window.status=myC_y;
          }
         }
         function showDiv2(obj)
          {
          inputName=form1.txt1;
          var e=obj;
          var ot = obj.offsetTop;
          var ol=obj.offsetLeft;
          while(obj=obj.parentElement){ot+=obj.offsetTop;ol+=obj.offsetLeft;}
          myC_div.style.pixelTop=ot+e.offsetHeight;
      myC_div.style.pixelLeft=ol;
      myC_div.style.display="block";
          }        
        function createInput(name)
          {myC_div.style.display='none';
            document.write("<input type='text' name='"+name+"' size=20 onfocus='showDiv2(this)'>");       
          }
       
   // --------------End ---------------------               
               
</script>
        <script>
var myCalendar=new myCalendar;
    myCalendar.year=2004;
    myCalendar.show();
   myCalendar.input("txt1");
</script>
      </form> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
  <tr>
    <td> </td>
    <td> </td>
  </tr>
</table>
</body>
</html>

文章作者:未知  整理日期:2008-03-23
[文章浏览:][打印文章][发送文章]
相关文章
·ASP用JavaScript脚本实现分页的办法 2008-03-07
·Javascript:keyCode键盘键码值表 2008-03-07
·用 JavaScript 简单实现网页的中文简体繁体的转换 2005-07-26
·JavaScript 弹出窗口代码 一 2005-10-09
·JavaScript表单验证 2005-12-15
·HTML 与 JavaScript 在线相互转换 2006-01-14
·用 JavaScript 验证身份证号码 2006-02-07
·JavaScript 判断表单输入内容 一 2006-02-07
·JavaScript 判断表单输入内容 二 2006-02-07
·JavaScript 弹出窗口代码 二 2006-02-07
阅读说明
·本站大部分文章转载于网络,如有侵权请留言告知,本站即做删除处理。
·本站法律法规类文章转载自[中国政府网(www.org.cn)],相关法律法规如有修订,请浏览[中国政府网]网站。
·本站转载的文章,不为其有效性,实效性,安全性,可用性等做保证。
·如果有什么问题,或者意见建议,请联系[网站管理员]
原“浪人文章”网站改名“老若尔文章站”,域名:article.lre.cn
本站使用【啊估文章站】网站系统    [联系网站管理员]         闽ICP备08009617号