求Java万年历源代码!!!

我有一个JS。你想要吗?

你可以改变他。我没时间帮你。!!

!-日期框选择-& gt;& gt

var DS_x,DS _ y;

函数dateSelector() //构造dateSelector对象,用于实现一个日历形式的日期输入框。

{

var myDate = new Date();

this . year = mydate . get full year();//定义年份属性和年份。默认值是当前系统年份。

this . month = mydate . getmonth()+1;//定义月份属性,默认值为当前系统月份。

this . date = mydate . getdate();//定义日期属性,默认值为当前系统的日期。

this . input name =“”;//定义inputName属性,即输入框的名称。默认值为空。注意:同一页面出现多个日期输入框,不能有重名!

this.display = display//定义显示日期输入框的显示方法。

}

函数display() //定义了dateSelector的显示方法,将实现一个日历形式的日期选择框。

{

Var week =新数组('天','一','二','三','四','五','六');

document . write(" & lt;style type=text/css >);

文档。写(“。ds _ fonttd,span { font:normal 12px;Ð;颜色:# 000000;}");

document.write("。ds _ border { border:1px solid # 000000;光标:手;背景色:# ddddd } ";

document.write("。ds _ border 2 { border:1px solid # 000000;光标:手;背景色:# ddddd } ";

document . write(" & lt;/style >);

var M =新字符串(this . month);

var d =新字符串(this . date);

if(m . length = = 1 & amp;& ampd.length==1){

document . write(" & lt;input style = ' text-align:center;'id = ' ds _ "+这个。InputName+"'Name =' "+this。InputName+"'Value =' "+this。年份+"-0 "+这个。月+"-0 "+这个。Date+"'Title =双击编辑OnDLICK = '。this . focus()' onblur = ' this . readonly = true ' readonly & gt;");}

else if(m . length = = 1 & amp;& ampd.length==2){

document . write(" & lt;input style = ' text-align:center;'id = ' ds _ "+这个。InputName+"'Name =' "+this。InputName+"'Value =' "+this。年份+"-0 "+这个。月+"-"+这个。Date+"'Title =双击编辑Ondblclick =' this。this . focus()' onblur = ' this . readonly = true ' readonly & gt;");}

else if(m . length = = 2 & amp;& ampd.length==1){

document . write(" & lt;input style = ' text-align:center;'id = ' ds _ "+这个。InputName+"'Name =' "+this。InputName+"'Value =' "+this。年份+"-"+这个。月+"-0 "+这个。Date+"'Title =双击编辑Ondblclick =' this。this . focus()' onblur = ' this . readonly = true ' readonly & gt;");}

else if(m . length = = 2 & amp;& ampd.length==2){

document . write(" & lt;input style = ' text-align:center;'id = ' ds _ "+这个。InputName+"'Name =' "+this。InputName+"'Value =' "+this。年份+"-"+这个。月+"-"+这个。Date+"'Title =双击编辑Ondblclick =' this...this . focus()' onblur = ' this . readonly = true ' readonly & gt;");}

document . write(" & lt;按钮style = ' width:60px;身高:18px;font-size:12px;保证金:1px;边框:1px实心# A4B3C8'背景色:# dfe 7 ef;'type = button onclick = this . next sibling . style . display = ' block ' onfocus = this . blur()& gt;日期

document . write(" & lt;div style = ' position:absolute;显示:无;文本对齐:居中;宽度:0px高度:0pxoverflow:visible ' onselectstart = ' return false;'& gt");

document . write(" & lt;div style = ' position:absolute;左:-60px;top:20px;宽度:142 px;身高:165 px;背景色:# F6F6F6' border:1px solid # 245 b7d;'class=ds_font>。");

document . write(" & lt;table cell padding = 0 cellspacing = 1 width = 140 height = 20 bgcolor = # cedae 7 onmousedown = ' DS _ x = event . x-parent node . style . pixel left;DS _ y = event . y-parent node . style . pixel top;set capture();'onmouseup = ' release capture();'onmousemove = ' ds move(this . parent node)' style = ' cursor:move;'& gt");

document . write(" & lt;tr align=center >);

document . write(" & lt;TD width = 12% onmouseover = this。onmouseout = this。class name = ' ' onclick = year(this)title = '减少年份' > & lt& lt& lt/TD >;);

document . write(" & lt;TD width = 12% onmouseover = this。onmouseout = this。class name = ' ' onclick = month(this)title = ' reduced month ' > & lt;& lt/TD >;);

document . write(" & lt;td宽度= 52% & gt;& ltb >;+this . year+" & lt;/b & gt;& ltb & gt年份:& ltb >;+this . month+" & lt;/b & gt;& ltb & gt月份。& lt/TD >;);

document . write(" & lt;TD width = 12% onmouseover = this . class name = ' ds _ border ' onmouseout = this . class name = ' ' onclick = add month(this)title = ' add month ' > & gt;& lt/TD >;);

document . write(" & lt;TD width = 12% onmouseover = this。onmouseout = this。class name = ' ' onclick = add year(this)title = '增加年份' > & gt& gt& lt/TD >;);

document . write(" & lt;/tr >;);

document . write(" & lt;/table >);

document . write(" & lt;table cell padding = 0 cellspacing = 0 width = 140 height = 20 onmousedown = ' DS _ x = event . x-parent node . style . pixel left;DS _ y = event . y-parent node . style . pixel top;set capture();'onmouseup = ' release capture();'onmousemove = ' ds move(this . parent node)' style = ' cursor:move;'& gt");

document . write(" & lt;tr align=center >);

for(I = 0;我& lt7;i++)

document . write(" & lt;TD >;+week[I]+" & lt;/TD >;);

document . write(" & lt;/tr >;);

document . write(" & lt;/table >);

document . write(" & lt;table cell padding = 0 cell spacing = 2 width = 140 bgcolor = # EEEEEE & gt;");

for(I = 0;我& lt6;i++)

{

document . write(" & lt;tr align=center >);

for(j = 0;j & lt7;j++)

document . write(" & lt;TD width = 10% height = 16 onmouseover = if(this . innertext!=“”& amp;& ampthis.className!= ' ds _ border 2 ')this . class name = ' ds _ border ' onmouseout = if(this . class name!= ' DS _ border 2 ')this . class name = ' ' onclick = getValue(this,document . all(' DS _ "+this . input name+" '))& gt;& lt/TD >;);

document . write(" & lt;/tr >;);

}

document . write(" & lt;/table >);

document . write(" & lt;span style = cursor:hand onclick = this . parent node . parent node . style . display = ' none ' & gt;关闭

document . write(" & lt;/div >;");

document . write(" & lt;/div >;");

dateShow(document . all(" DS _ "+this . input name). next sibling . next sibling . child nodes[0])。子节点[2],今年,本月)

}

函数年(obj)//递减年

{

var myObj = obj . parent node . parent node . parent node . cells[2]。子节点;

myObj[0]。innerHTML=eval(myObj[0])。innerHTML)-1;

dateShow(obj . parent node . parent node . parent node . next sibling . next sibling,eval(myObj[0])。innerHTML)、eval(myObj[2]。innerHTML))

}

函数addYear(obj) //添加年份。

{

var myObj = obj . parent node . parent node . parent node . cells[2]。子节点;

myObj[0]。innerHTML=eval(myObj[0])。innerHTML)+1;

dateShow(obj . parent node . parent node . parent node . next sibling . next sibling,eval(myObj[0])。innerHTML)、eval(myObj[2]。innerHTML))

}

函数month(obj)//减少月份

{

var myObj = obj . parent node . parent node . parent node . cells[2]。子节点;

var month=eval(myObj[2])。innerHTML)-1;

if(month==0)

{

月= 12;

子年(obj);

}

myObj[2]。innerHTML =月;

dateShow(obj . parent node . parent node . parent node . next sibling . next sibling,eval(myObj[0])。innerHTML)、eval(myObj[2]。innerHTML))

}

函数addMonth(obj) //添加月份

{

var myObj = obj . parent node . parent node . parent node . cells[2]。子节点;

var month=eval(myObj[2])。innerHTML)+1;

if(month==13)

{

月= 1;

add year(obj);

}

myObj[2]。innerHTML =月;

dateShow(obj . parent node . parent node . parent node . next sibling . next sibling,eval(myObj[0])。innerHTML)、eval(myObj[2]。innerHTML))

}

函数dateshow (obj,year,month)//显示每个月的第几天。

{

var myDate =新日期(年,月-1,1);

var today = new Date();

var day = mydate . getday();

var select date = obj . parent node . parent node . previous sibling . previous sibling . value . split('-');

可变长度;

开关(月)

{

案例1:

案例三:

案例5:

案例7:

案例8:

案例10:

案例12:

长度= 31;

打破;

案例4:

案例6:

案例9:

案例11:

长度= 30;

打破;

案例二:

if((year % 4 = = 0)& amp;& amp(年份%100!=0)||(年份%400==0))

长度= 29;

其他

长度= 28;

}

for(I = 0;我& ltobj.cells.lengthi++)

{

单元格[i]。innerHTML =“”;

obj . cells[I]. style . color =“”;

单元格[i]。class name =“”;

}

for(I = 0;我& lt长度;i++)

{

对象单元格[I+天]。innerHTML =(I+1);

if(year = = today . get full year()& amp;& amp(month-1)= = today . getmonth()& amp;& amp(i+1)==today.getDate())

obj . cells[I+day]. style . color = ' red ';

if(year = = eval(select date[0])& amp;& ampmonth = = eval(select date[1]);& amp(i+1)==eval(selectDate[2])

对象单元格[I+天]。' ds _ border 2 ';

}

}

Function getvalue (obj,inputobj)//将选择的日期传递给输入框。

{

var myObj = inputobj . next sibling . next sibling . child nodes[0]。子节点[0]。单元格[2]。子节点;

if(obj.innerHTML)

if(obj . innerhtml . length = = 1 & amp;& ampmyObj[2]. innerhtml . length = = 1)

inputObj.value=myObj[0]。innerHTML+"-0"+myObj[2]。innerHTML+"-0 "+obj . innerHTML;

else if(obj . innerhtml . length = = 1 & amp;& ampmyObj[2].innerHTML.length==2)

inputObj.value=myObj[0]。innerHTML+"-"+myObj[2]。innerHTML+"-0 "+obj . innerHTML;

else if(obj . innerhtml . length = = 2 & amp;& ampmyObj[2]. innerhtml . length = = 1)

inputObj.value=myObj[0]。innerHTML+"-0"+myObj[2]。innerHTML+"-"+obj . innerHTML;

else if(obj . innerhtml . length = = 2 & amp;& ampmyObj[2].innerHTML.length==2)

inputObj.value=myObj[0]。innerHTML+"-"+myObj[2]。innerHTML+"-"+obj . innerHTML;

input obj . next sibling . next sibling . style . display = ' none ';

for(I = 0;我& ltobj . parent node . parent node . parent node . cells . length;i++)

obj . parent node . parent node . parent node . cells[I]。class name =“”;

' ds_border2 '

}

函数dsMove(obj) //拖动图层。

{

if(event.button==1)

{

var X = obj.clientLeft

var Y = obj.clientTop

obj . style . pixel left = X+(event . X-DS _ X);

obj . style . pixel top = Y+(event . Y-DS _ Y);

}

}

/* * *呼叫代码* *

& lt脚本语言= javascript & gt

var myDate = new date selector();

mydate . year = 1900;//morenqiri

myDate.inputName = ' date//

mydate . display();

& lt/script & gt;

*/