发新话题
打印

源码学习:一个简单的日历控件(1)

源码学习:一个简单的日历控件(1)



6 [% }/ I2 H3 Q- w$ H0 _, t
' a8 F7 E# ~- f9 r6 zcalendar.js  
9 C0 F% [+ M" w: ]( G7 t
6 y) x$ k% ?4 e4 K7 H- w5 ~. Z/ Xfunction atCalendarControl(){
$ S: N+ _* \8 f var calendar=this;5 R8 k/ g! y$ ]
this.calendarPad=null;
& s( n+ _1 A: s" d0 K this.prevMonth=null;" a! _. f5 e" C% h4 P- V
this.nextMonth=null;
( A  K9 L. l) J, Q' k this.prevYear=null;
$ u7 P6 G3 }4 a8 x' T! Q this.nextYear=null;
. h! ^4 @, G4 ?, Y0 t' r) }, c this.goToday=null;
: z$ B9 G- N2 n6 D- F" [, o this.calendarClose=null;3 A) G; h+ T: I, J0 R* E
this.calendarAbout=null;
8 V2 S2 ?+ Q- D1 C- i+ a, b& A' t4 U this.head=null;2 d( k0 _3 A+ w3 _! [! K. _
this.body=null;
0 B2 w1 n7 @4 T9 j$ @, [ this.today=[];
1 ?8 q& u/ H, E7 z# l  z this.currentDate=[];
7 t+ Z6 `! X1 Y! N7 B( H this.sltDate;5 e  h% f5 |; ?  T
this.target;
8 ]' S* N$ M0 C2 L. S: r this.source;  / e! G. v# z* ]2 l2 G0 R( M5 W
& `! G5 Y6 Y2 S5 Q
/************** 加入日历底板及阴影 *********************/$ h0 ?  g. J' O* C# r
this.addCalendarPad=function(){8 X' `6 V6 a/ Y7 w  g! B( a
document.write("div id='divCalendarpad' style='position:absolute;top:100;left:0;width:255;height:167;display:none;'");
: y) f! Z$ C4 g document.write("iframe frameborder=0 height=168 width=255/iframe");+ t; o5 b' U, `4 y$ x6 g8 J" w
document.write("div style='position:absolute;top:4;left:4;width:248;height:164;background-color:#336699;'/div");
' z& l; F' C$ c7 k9 i document.write("/div");
- d" Q7 i" m6 v& H3 I# I% c" F calendar.calendarPad=document.all.divCalendarpad;8 o; [0 \% l- U
}
/ U4 W/ e+ f! a0 e  f7 W9 g9 g! D /************** 加入日历面板 *********************/4 _3 @3 X9 q5 C# y; k: h- u
this.addCalendarBoard=function(){
1 u0 S2 t* a' l! x% \ var BOARD=this;; V( u0 S2 S7 \; `* P
var divBoard=document.createElement("div");
; G6 b# M2 p$ i& C8 C calendar.calendarPad.insertAdjacentElement("beforeEnd",divBoard);6 [9 H0 t7 j( K8 P( N  \
divBoard.style.cssText="position:absolute;top:0;left:0;width:250;height:166;border:1 outset;background-color:buttonface;";



点击图标进入精品网摘收藏 欢迎大家加入网络收藏夹

TOP

发新话题