Cell.innertext = lastdate.getdate () - DATE.GETDAY () i 1;
Cell.style.color = "# 999999";
Cell.Value = New Date (Year, Month-1 (Lastdate.getdate () - Date.getDay () i 1));
}
Else {
Cell.innertext = i 1-Date.getDay ();
Cell.style.color = "# 000000";
Cell.Value = New Date (Year, Month, i 1-Date.getDay ());
}
}
For (i = 7; i <42; i ) {
Day = i 1-Date.getDay ();
Var cell = evAl (OdateView) .ROWS (Math.Floor (I / 7) 2) .Cells (I% 7);
IF (days <= maxday) {
Cell.innerhtml = day;
Cell.style.color = "# 000000";
Cell.Value = New Date (Year, Month, day);
}
Else {
Cell.innerhtml = day-maxday;
Cell.style.color = "# 999999";
Cell.Value = New Date (Year, Month 1, day-maxday);
}
}
}
Function DisplayDateView () {
OdateView.style.Left = getoffsetleft (Element);
OdateView.Style.top = getoffsettop (element) Element.offsetHeight;
IF (OdateView.Style.display = "none") {
OdateView.style.display = "block";
}
Else {
OdateView.style.display = "none";
}
}
Function DocumentClick () {
Var e = window.event.srcelement;
IF ((e.tagname.tolowercase ()! = "input") || ((E.TAGNAME.TOLOWERCASE () == "Input") && (E.PRESET == NULL)) && (! iSexists E, ODATEVIEW)))))
OdateView.style.display = "none";
}
}
Function ISEXISTS (SRC, DST) {
IF (src.tagname! = "body") {
IF (src.parentelement == DST) Return True;
Return ISEXISTS (Src.Parentelement, DST)
}
Return False;
}
Function GetOffsetleft (src) {var set = 0;
IF (src)
{
IF (src.offsetparent)
Set = src.offsetleft getoffsetleft (src.offsetparent);
IF (src.tagname! = "body")
{
Var x = parseint (src.scrollleft, 10);
IF (! isnan (x))
Set- = x;
}
}
Return set;
}
Function getoffsettop (src) {
Var set = 0;
IF (src)
{
IF (src.offsetparent)
Set = src.offsettop getoffsettop (src.offsetparent);
IF (src.tagname! = "body")
{
VAR Y = PARSEINT (Src.Scrolltop, 10);
IF (! isnan (y))
Set- = Y;
}
}
Return set;
}
// Initialization control
Function doinit ()
{
Var stag = tagname.tolowercase ();
IF (stag == "infut") {
Attachevent ("Onblur", InputBluR);
IF (this.preset == "Date") Attachevent ("OnClick", click;
}
}
// mouse moving triggers
Function InputMouseOver () {
Element.classname = "clsinputmouseover";
}
// Mouse removal trigger
Function InputMouseout () {
Element.classname = "clsinput";
}
Function InputBlur ()
{
IF (value == ") RETURN;
Switch (this.preset)
{
Case "Date":
IF (value == ") RETURN
Var REG = / ^ [1-2] {1,1} [0-9] {3, 3} [/] {1,1} [0-9] {1,2} [/] {1,1 } [0-9] {1, 2} $ /;
IF (! reg.test (value)) {
ReturNError ("Invalid Date Format");
}
Break;
Case "float":
Var REG = /^ [0-9] 2 2 }[.]{ 0,1 }[0-9]{ 0, 4})
IF (! reg.test (value)) {
ReturNError ("Invalid Digital Format");
}
Break;
Case "email":
Var reg = / ^/w ((-/w )| (/w ))**/@/w ( ((/.| )/w )**/w or above;
IF (! reg.test (value)) {
ReturNError ("Invalid Email Format";
}
Break;
}
}
Function ReturNerror (SMSG)
{
VAR OEVENT = CREATEEVENTOBJECT ();
OEvent.SetAttribute ("Error", SMSG);
Error.fire (OEVENT);
ELEMENT.FOCUS ();
Alert (SMSG);
script>
Mask.css
.clsinput
{
Border: # 999999 1px solid;
Background-color: # f5f5f1;
FONT: 12PX Song;
Width: 95%;
Behavior: URL (Mask.htc);
}
.clsinputMouseover
{
Border: # 000000 1px solid;
Background-color: # fffff1;
FONT: 12PX Song;
Width: 95%;
Behavior: URL (Mask.htc);
}
.clsdateview
{
Border: # 999999 1px solid;
FONT-SIZE: 12PX;
Background-color: #fffcc;
TEXT-ALIGN: CENTER;
Position: absolute;
LEFT: AUTO;
Top: Auto;
Width: 200;
}
.clsdateviewheader
{
Border: 1px Solid # 3399ff; Background-Color: # 990000; Color: #fffcc
}
.ClsdateViewweek
{
Background-color: # ffcc66; color: # 663399
}
.clsdateviewday
{
Background-color: #fffcc;
}
.clsdateviewDayover
{
Background-color: # ffcc66;
}
Test.htm