郭建栋ID:gjd111686
156399次访问,排名447好友0人,关注者1
gjd111686的文章
原创 191 篇
翻译 0 篇
转载 0 篇
评论 69 篇
数字金刚的公告
数字金刚

日本人与台独分子禁止入内


郭煜,字建栋.别号冷冰、数字金刚. 赵国人.并州太原府代州[今山西省五台山北台顶]. 乙亥年甲申闯关东至盛京[今辽宁省沈阳]已九载.
最近评论
vvukqr:WoW Gold
komelio:很niuB的代码
mrli12:和我想法一样,通用!!~ :-)
不过这么写实在繁琐,要进一步改进,最好能将bean直接引入,通过接口,最好是设计成用xml文件映射的,这样输入什么对象,出什么图形在里面都定义好了,直接就出来了,哪位高手有时间研究研究!?
独侠:import org.jfree.data.xy.SignalsDataset
好像JAR里面没有这个类,运行出错
binbin:可否请教一下,pdflib是怎样生成表格的?no.credit@gmail.com
文章分类
收藏
    相册
    帮助资源
    个人素描
    杀手锏
    资源图片
    铁血民族
    民族魂:网上人民英雄纪念碑(RSS)
    推荐经典
    CodeGuru
    CodeProject
    VC知识库
    中国标准XML
    软件工程专家网
    问专家
    仪器仪表
    21IC中国电子网
    中华工控网
    中国自动化网
    仪器仪表商情网
    传感器世界
    自家小院
    挚友链接
    数字金刚
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 Web上日历选择的HTC封装组件收藏

    新一篇: Textarea标签封装为Web在线编辑器 | 旧一篇: Web上的通用对话框封装

    Date.htm

    <input type="text" style="behavior:url('Date.htc');" value="2004-01-01">


     

    Date.htc

    <public:attach event=oncontentready onevent=initDate()>
    <script>
    //该HTC组件目前只支持INPUT并TYPE=TEXT下使用

    //日期面板容器
    var vDiv=null;
    //框架
    var vFieldset=null;
    //日期面板
    var vTable=null;
    //日期格式字符串
    var strDate="";

    //静态数组
    var strWeekArray=new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");

    function initDate()
    {
     //初始化日期
     if(element.value)
     {strDate=element.value;}
     else
     {strDate=getToday();}
     //创建容器
     vDiv=document.createElement("vDiv");
     vDiv.style.position="absolute";
     vDiv.style.left=0;
     vDiv.style.top=0;
     vDiv.style.width="275px";
     //绘制框架
     vFieldset=document.createElement("fieldset");
     var vLegend=document.createElement("legend");
     vLegend.style.font="normal 9pt 宋体";
     vLegend.innerHTML="日期";
     vFieldset.appendChild(vLegend);
     //绘制年月栏
     initYearMonthBar();
     //绘制面板
     initPanel();
     //绘制控制区
     initConsole();

     vDiv.appendChild(vFieldset);
     window.document.body.insertAdjacentElement("afterbegin",vDiv);
     vDiv.style.display="none";

     //事件绑定
     element.attachEvent("onmousedown",onMouseDown);
     element.readOnly="true";
    }
    //绘制面板
    function initPanel()
    {
     vTable=document.createElement("table");
     vTable.style.backgroundColor="#EEEEEE";
     vTable.border="0";
     vTable.cellSpacing="1";
     vTable.cellPadding="0";
     //vTable.width="80%";
     vTable.style.borderLeft="1px solid #000000";
     vTable.style.borderBottom="1px solid #000000";
     initWeekCol();
     initDayCell();
     vFieldset.appendChild(vTable);
    }
    //画年月
    function initYearMonthBar()
    {
     vInput=document.createElement("input");
     vInput.type="button";
     vInput.style.font="normal 9pt Marlett";
     vInput.value="3";
     vFieldset.appendChild(vInput);
     vSelect=document.createElement("select");
     vSelect.style.font="normal 8pt 宋体";
     for(mIndex=eval("getDateYear()-20");mIndex<=eval("getDateYear()+20");mIndex++)
     {
      vOption=document.createElement("option");
      vOption.value=mIndex;
      vOption.text=mIndex+"年";    
      vSelect.add(vOption);
      if(getDateYear()==mIndex)
      {
       vOption.selected="selected";
      }
     }
     vSelect.attachEvent("onchange",onYearChange);
     vFieldset.appendChild(vSelect);
     vInput=document.createElement("input");
     vInput.type="button";
     vInput.style.font="normal 9pt Marlett";
     vInput.value="4";
     vFieldset.appendChild(vInput);

     vInput=document.createElement("input");
     vInput.type="button";
     vInput.style.font="normal 9pt Marlett";
     vInput.value="3";
     vFieldset.appendChild(vInput);
     vSelect=document.createElement("select");
     vSelect.style.font="normal 8pt 宋体";
     var now=new Date();
     for(nIndex=1;nIndex<=12;nIndex++)
     {
      vOption=document.createElement("option");
      vOption.value=strFormat(nIndex,2);
      vOption.text=strFormat(nIndex,2)+"月";  
      vSelect.add(vOption);
      if(getDateMonth()==nIndex)
      {
       vOption.selected="selected";
      }
     }
     vSelect.attachEvent("onchange",onMonthChange);
     vFieldset.appendChild(vSelect);
     vInput=document.createElement("input");
     vInput.type="button";
     vInput.style.font="normal 9pt Marlett";
     vInput.value="4";
     vFieldset.appendChild(vInput);
    }
    //绘制控制区
    function initConsole()
    {
     vInput=document.createElement("input");
     vInput.type="button";
     vInput.style.font="normal 9pt 宋体";
     vInput.value="今天";
     vInput.attachEvent("onmousedown",onTodayMouseDown);
     vFieldset.appendChild(vInput);

     vInput=document.createElement("input");
     vInput.type="button";
     vInput.style.font="normal 7pt Webdings";
     vInput.value="a";
     vInput.attachEvent("onmousedown",onOKMouseDown);
     vFieldset.appendChild(vInput);
     
     vInput=document.createElement("input");
     vInput.type="button";
     vInput.style.font="normal 7pt Webdings";
     vInput.value="r";
     vInput.attachEvent("onmousedown",onCancelMouseDown);
     vFieldset.appendChild(vInput);
    }
    function onTodayMouseDown()
    {
     strDate=getToday();
     element.value=strDate;
     hideDate();
    }
    function onOKMouseDown()
    {
     element.value=strDate;
     hideDate();
    }
    function onCancelMouseDown()
    {
     hideDate();
    }
    //画星期列
    function initWeekCol()
    {
     var vTr=vTable.insertRow(0);
     for(nIndex=0;nIndex<7;nIndex++)
     {
      var vTd=vTr.insertCell(nIndex);
      vTd.innerHTML=strWeekArray[nIndex];
      vTd.style.font="normal 9pt 宋体";
      vTd.style.borderTop="1px solid #000000";
      vTd.style.borderRight="1px solid #000000";
      vTd.style.backgroundColor="#DDDDDD";
     }
    }
    //画天单元格
    function initDayCell()
    {
     var iCurDay=0;
     for(mIndex=1;mIndex<7;mIndex++)
     {
      var vTr=vTable.insertRow(mIndex);
      for(nIndex=0;nIndex<7;nIndex++)
      {
       var vTd=vTr.insertCell(nIndex);
       if(mIndex==1&&nIndex==1*getYearMonthWeek())
       {
        iCurDay=1;
        vTd.innerHTML=iCurDay;
       }
       else if(iCurDay!=0&&iCurDay<=1*getYearMonthDays())
       {
        vTd.innerHTML=iCurDay;
       }
       else
       {
        vTd.innerHTML="&nbsp;"
       }
       if(iCurDay==getDateDay())
       {
        vTd.style.color="#FF0000";
       }
       if(iCurDay!=0)
       {
        iCurDay++;
       }
       vTd.style.font="normal 9pt 宋体";
       vTd.style.borderTop="1px solid #000000";
       vTd.style.borderRight="1px solid #000000";
       vTd.attachEvent("onmousedown",onCellMouseDown);
      }
     }
    }
    //选择框年鼠标按下
    function onYearChange()
    {
     var vObject=window.event.srcElement;
     var strYearMonth=strDate.split("-");
     strDate=vObject.options[vObject.selectedIndex].value+"-"+strYearMonth[1]+"-"+strYearMonth[2];
     for(iRowCount=6;iRowCount>=1;iRowCount--)
     {
      vTable.deleteRow(iRowCount);
     }
     initDayCell();
    }
    //选择框月鼠标按下
    function onMonthChange()
    {
     var vObject=window.event.srcElement;
     var strYearMonth=strDate.split("-");
     strDate=strYearMonth[0]+"-"+vObject.options[vObject.selectedIndex].value+"-"+strYearMonth[2];
     for(iRowCount=6;iRowCount>=1;iRowCount--)
     {
      vTable.deleteRow(iRowCount);
     }
     initDayCell();
    }
    //单元格天鼠标按下
    function onCellMouseDown()
    {
     for(mIndex=1;mIndex<7;mIndex++)
     {
      for(nIndex=0;nIndex<7;nIndex++)
      {
       vTable.rows(mIndex).cells(nIndex).style.backgroundColor="transparent";
      }
     }
     var vObject=window.event.srcElement;
     var strYearMonth=strDate.split("-");
     strDate=strYearMonth[0]+"-"+strYearMonth[1]+"-"+strFormat(vObject.innerHTML,2);
     vObject.style.backgroundColor="#FFFFFF";
    }
    //元素中鼠标按下[显示面板]
    function onMouseDown()
    {
     if(element.value)
     {strDate=element.value;}
     else
     {strDate=getToday();}
     for(iRowCount=6;iRowCount>=1;iRowCount--)
     {
      vTable.deleteRow(iRowCount);
     }
     initDayCell();
     showDate();
    }
    //文档中鼠标按下[隐藏面板]
    function onDocumentMouseDown()
    {
     if(element.contains(event.srcElement))
     {
      return;
     }
     if(vDiv.contains(event.srcElement))
     {
      return;
     }
     hideDate();
     strDate="";
    }
    //库函数
    //显示面板
    function showDate()
    {
     vDiv.style.display="";
     vDiv.style.left=getElementDefineLeft(element);
     vDiv.style.top=getElementDefineTop(element)+element.offsetHeight;
     element.document.attachEvent('onmousedown',onDocumentMouseDown);
    }
    //隐藏面板
    function hideDate()
    {
     vDiv.style.display="none";
     vDiv.style.left=0;
     vDiv.style.top=0;
     element.document.detachEvent("onmousedown",onDocumentMouseDown); 
    }
    //取元素绝对位置Left
    function getElementDefineLeft(vObject)
    {
     var iElementLeft=vObject.offsetLeft;
     while(vObject=vObject.offsetParent)
     {
      iElementLeft+=vObject.offsetLeft;
     }
     return iElementLeft;
    }
    //取元素绝对位置Top
    function getElementDefineTop(vObject)
    {
     var iElementTop=vObject.offsetTop;
     while(vObject=vObject.offsetParent)
     {
         iElementTop+=vObject.offsetTop;
     }
     return iElementTop;
    }
    //格式化串
    function strFormat(str,iLen)
    {
     if(str.length<iLen)
     {
      for(iIndex=0;iIndex<iLen-str.length;iIndex++)
      {
       str="0"+str;
      }
      return str;
     }
     else
     {return str;}
    }
    //获取今天日期
    function getToday()
    {
     var vNow=new Date();
    return strFormat(vNow.getYear(),4)+"-"+strFormat(vNow.getMonth()+1,2)+"-"+strFormat(vNow.getDate(),2);
    }
    //计算某年某月某日返回年
    function getDateYear()
    {
     var strYearMonth=strDate.split("-");
     return eval("1*strYearMonth[0]");
    }
    //计算某年某月某日返回月
    function getDateMonth()
    {
     var strYearMonth=strDate.split("-");
     return eval("1*strYearMonth[1]");
    }
    //计算某年某月某日返回日
    function getDateDay()
    {
     var strYearMonth=strDate.split("-");
     return eval("1*strYearMonth[2]");
    }
    //计算某年某月第一天是星期几
    function getYearMonthWeek()
    {
     var strYearMonth=strDate.split("-");
     var vDate=new Date(strYearMonth[0],parseInt(strYearMonth[1])-1,1);
     return vDate.getDay();
    }
    //计算某年某月天数
    function getYearMonthDays()
    {
     var strYearMonth=strDate.split("-");
     var vDate=new Date(strYearMonth[0],strYearMonth[1],"0");
     return vDate.getDate();
    }
    //
    //闰年的条件是:能被4整除且不能被100整除,或能被400整除的年份是闰年.
    //
    </script>
    </public:attach>

    发表于 @ 2004年12月02日 12:00:00|评论(loading...)|编辑

    新一篇: Textarea标签封装为Web在线编辑器 | 旧一篇: Web上的通用对话框封装

    评论

    #cqhydz 发表于2005-01-18 16:04:00  IP: 211.158.82.*
    年和月左右的按钮无效啊,而且提个意见。我觉得还要加上时间就更完善了
    #数字金刚 发表于2005-01-21 14:27:00  IP: 218.24.205.*
    有时间我就会做一下.
    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © 数字金刚