Current location - Training Enrollment Network - Books and materials - Seek Java perpetual calendar source code! ! !
Seek Java perpetual calendar source code! ! !
I have a JS. Do you want it?

You can change him. I have no time to help you. ! !

! -Date box selection-> & gt

var DS_x,DS _ y;

The function dateSelector() // constructs the dateSelector object, which is used to realize a date input box in the form of a calendar.

{

var myDate = new Date();

this . year = mydate . get full year(); //Define the year attribute and year. The default value is the current system year.

this . month = mydate . getmonth()+ 1; //Defines the month attribute. The default value is the current system month.

this . date = mydate . getdate(); //Define the date attribute. The default value is the date of the current system.

this . input name =“”; //Define the inputName attribute, which is the name of the input box. The default value is empty. Note: Multiple date input boxes appear on the same page, and there cannot be duplicate names!

This.display = display// defines the display method of the display date input box.

}

The function display() // defines the display method of dateSelector, which will realize a date selection box in the form of calendar.

{

Var week = new array ('days',' one',' two',' three',' four',' five',' six');

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

Documents. Write (". ds _ fonttd,span { font:normal 12px; ; Color: # 000000; }");

document.write("。 ds _ border { border: 1px solid # 000000; Cursor: hand; Background color: # ddddd} ";;

document.write("。 ds _ border 2 { border: 1px solid # 000000; Cursor: hand; Background color: # ddddd} ";;

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

Var M = new string (this.month);

Var d = new string (this.date);

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

document . write(" & lt; input style = ' text-align:center;' Id =' ds _ "+ this. InputName+"'Name =' "+this。 InputName+"'Value =' "+this。 Year +"-0 "+ this. Month +"-0 "+ this. Date+"'Title = double-click to edit 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 _ "+ this. InputName+"'Name =' "+this。 InputName+"'Value =' "+this。 Year +"-0 "+ this. Month+"-"+this. Date+"'Title = Double-click to edit 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 _ "+ this. InputName+"'Name =' "+this。 InputName+"'Value =' "+this。 Year+"-"+this. Month +"-0 "+ this. Date+"'Title = Double-click to edit 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 _ "+ this. InputName+"'Name =' "+this。 InputName+"'Value =' "+this。 Year+"-"+this. Month+"-"+this. Date+"'Title = double-click to edit ondblclick =' this ... this.focus ()' onblur =' this.readonly = true' readonly > "); }

document . write(" & lt; Button style =' width:60px;; Height:18px; font-size: 12px; Margin:1px; Border: 1px solid # A4B3C8' background color: # dfe7ef; 'type = button onclick = this . next sibling . style . display = ' block ' onfocus = this . blur()& gt; date

document . write(" & lt; div style = ' position:absolute; Display: None; Text alignment: centered; Width: 0px height: 0px overflow: visible' onselectstart =' return false;' & gt");

document . write(" & lt; div style = ' position:absolute; Left:-60px; top:20px; Width:142px; Height:165px; Background color: # f6f6f6' border:1pxsolid # 245b7d; '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 =' decrease year' > < ; );

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 width = 52%>;; & ltb >; +this . year+" & lt; /b & gt; & ltb> year:<b >;; +this . month+" & lt; /b & gt; & ltb> month. & 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 =' add year' >>>& 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; I<7; 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; I<6; 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; close

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

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

dateShow(document . all(" DS _ "+this . input name). next sibling . next sibling . child nodes[0])。 Child node [2], this year, this month)

}

Function year (obj)// decreasing year

{

var myObj = obj . parent node . parent node . parent node . cells[2]。 Child node;

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))

}

The function addYear(obj) // adds the year.

{

var myObj = obj . parent node . parent node . parent node . cells[2]。 Child node;

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))

}

The function month(obj)// decreases the month.

{

var myObj = obj . parent node . parent node . parent node . cells[2]。 Child node;

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

if(month==0)

{

Month =12;

Subyear (obj);

}

myObj[2]。 InnerHTML = month;

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

}

Function addMonth(obj) // Add month

{

var myObj = obj . parent node . parent node . parent node . cells[2]。 Child node;

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

if(month== 13)

{

Month =1;

add year(obj);

}

myObj[2]。 InnerHTML = month;

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

}

The function dateshow (obj, year, month)// displays the day of each month.

{

Var myDate = new date (year, month-1,1);

var today = new Date();

var day = mydate . getday();

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

Variable length;

Switch (month)

{

Case 1:

Case 3:

Case 5:

Case 7:

Case 8:

Case 10:

Case 12:

Length = 31;

Break;

Case 4:

Case 6:

Case 9:

Case 1 1:

Length = 30;

Break;

Case 2:

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

Length = 29;

other

Length = 28;

}

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

{

Cell [i]. innerHTML =“”;

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

Cell [i]. class name =“”;

}

for(I = 0; I < length; i++)

{

Object cell [I+ days]. 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])

Object cell [I+ days]. ' ds _ border 2 ';

}

}

Function getvalue (obj, inputobj)// Pass the selected date to the input box.

{

var myObj = inputobj . next sibling . next sibling . child nodes[0]。 Child node [0]. Cell [2]. Child node;

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; I< obj. parentnode. parentnode. parentnode. cells.length; i++)

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

' ds_border2 '

}

Function dsMove(obj) // Drag the layer.

{

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

}

}

/* * * Call Code * *

& lt scripting language = javascript & gt

var myDate = new date selector();

mydate . year = 1900; //morenqiri

myDate.inputName = ' date//

mydate . display();

& lt/script & gt;

*/