日期:2014-05-18  浏览次数:20491 次

|M| 求大家给个漂亮的日历控件
也就是一个文本框点击出现一个日历选择的控件
要漂亮的

谢谢

------解决方案--------------------
不懂,帮楼主顶顶
------解决方案--------------------
漂亮的什么程度?
------解决方案--------------------
我的是自己写的!
就是不漂亮
不过如果你有天赋 要它怎么漂亮就怎么漂亮
------解决方案--------------------
<script language=javascript>
var DS_x,DS_y;

function dateSelector() //构造dateSelector对象,用来实现一个日历形式的日期输入框。
{
var myDate=new Date();
this.year=myDate.getFullYear(); //定义year属性,年份,默认值为当前系统年份。
this.month=myDate.getMonth()+1; //定义month属性,月份,默认值为当前系统月份。
this.date=myDate.getDate(); //定义date属性,日,默认值为当前系统的日。
this.inputName= ' '; //定义inputName属性,即输入框的name,默认值为空。注意:在同一页中出现多个日期输入框,不能有重复的name!
this.display=display; //定义display方法,用来显示日期输入框。
}

function display() //定义dateSelector的display方法,它将实现一个日历形式的日期选择框。
{
var week=new Array( '日 ', '一 ', '二 ', '三 ', '四 ', '五 ', '六 ');

document.write( " <style type=text/css> ");
document.write( " .ds_font td,span { font: normal 12px 宋体; color: #000000; } ");
document.write( " .ds_border { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD } ");
document.write( " .ds_border2 { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD } ");
document.write( " </style> ");

document.write( " <input style= 'text-align:center; ' id= 'DS_ "+this.inputName+ " ' name= ' "+this.inputName+ " ' value= ' "+this.year+ "- "+this.month+ "- "+this.date+ " ' title=双击可进行编缉 ondblclick= 'this.readOnly=false;this.focus() ' onblur= 'this.readOnly=true ' readonly> ");
document.write( " <button style= 'width:60px;height:18px;font-size:12px;margin:1px;border:1px solid #A4B3C8;background-color:#DFE7EF; ' type=button onclick=this.nextSibling.style.display= 'block ' onfocus=this.blur()> 选择日期 </button> ");

document.write( " <div style= 'position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible ' onselectstart= 'return false; '> ");
document.write( " <div style= 'position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid #245B7D; ' class=ds_font> ");
document.write( " <table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown= 'DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture(); ' onmouseup= 'releaseCapture(); ' onmousemove= 'dsMove(this.parentNode) ' style= 'cursor:move; '> ");
document.write( " <tr align=center> ");
document.write( " <td width=12% onmouseover=this.className= 'ds_border ' onmouseout=this.className= ' ' onclick=subYear(this) title= '减小年份 '> < < </td> ");
document.write( " <td width=12% onmouseover=this.className= 'ds_border ' onmouseout=this.className= ' ' onclick=subMonth(this) title= '减小月份 '> < </td> ");
document.write( " <td width=52%> <b> "+this.year+ " </b> <b> 年 </b> <b> "+this.month+ " </b> <b> 月 </b> </td> ");
document.write( " <td width=12% onmouseover=this.className= 'ds_border