當前位置:歷史故事大全網 - 圖書館 - 求Java萬年歷源代碼!!!

求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;

*/

  • 上一篇:5月1日武漢有燈展2021 5月1日武漢活動總結-時間地點
  • 下一篇:出版物編校質量現狀
  • copyright 2024歷史故事大全網