<Style type = "text/CSS"> <! --. Input1 {background-color: # ffffff; border-bottom: # ffffff 1px solid; border-left: #003399 1px solid; border-Right: #006666 1px solid; border-top: # 0033ff 1px solid; font-size: 13px ;}. input1-bor {background-color: #99 CCFF; font-size: 13px; Border: 1px solid #333333 ;}--> </style>
<SCRIPT><! -- Function check () // main function {var I, j = 0, count; long = document. form1.length; // number of elements in the form1 form COUNT = long-2-1; // The number of types in form1 is-1 with (document. form1) {for (I = 0; I <= count; I ++) {J = I + 1; if (item (I ). value. trim () = "") {alert ("time cannot be blank"); item (I ). focus (); Return false;} If (! Checkdate (item (I ). value) // call the checkdate function {item (I ). focus (); Return false;} else {standardtime (item (I); // call the standardtime function}
If (I <count )//
Determine whether the time is earlier than the previous time
{Firtime = item (I ). value; sectime = item (j ). value; firhour = parseint (firtime. split (":") [0], 10); firminiter = parseint (firtime. split (":") [1], 10); sechour = parseint (sectime. split (":") [0], 10); secminiter = parseint (sectime. split (":") [1], 10); If (firhour> = 1 & firhour <= 9) // hour firhour = "0" + firhour; if (firminiter> = 1 & firminiter <= 9) // minute firminiter = "0" + firminiter; firtimer = firhour + ":" + firminiter; if (sechour> = 1 & sechour <= 9) // hour sechour = "0" + sechour; If (secminiter> = 1 & secminiter <= 9) // secminiter = "0" + secminiter; sectimer = sechour + ":" + secminiter; If (firtimer> sectimer) {alert ("this time cannot be earlier than the previous time"); item (j ). focus (); Return false ;}
}} Return true ;}
Function standardtime (me )//
Change the end time to the Standard Time
{VaR etime, ETIM, etimminiter, etimhour; etime = me. value; ETIM = etime. split (":") etim1 = parseint (ETIM [0], 10); // hour etim2 = parseint (ETIM [1], 10); // minute if (! Etim1) // The hour is empty. etimhour = "00"; else {If (etim1> = 1 & etim1 <= 9) // The hour etimhour = "0" + etim1; elseetimhour = etim1} If (! Etim2) // The minute is empty. etimminiter = "00"; else {If (etim2> = 1 & etim2 <= 9) // The minute etimminiter = "0" + etim2; elseetimminiter = etim2} etimtimer = etimhour + ":" + etimminiter; me. value = etimtimer;
}
Function checkdate (YS )//
Determine the time format
{If (ys. split (":") [0]/1> 23 | Ys. split (":") [0]/1 <0 | isnan (ys. split (":") [0]) {alert ("sorry, the time you entered is invalid"); Return false;} If (ys. split (":") [1]/1> 59 | Ys. split (":") [1]/1 <0 | isnan (ys. split (":") [1]) {alert ("sorry, the time you entered is invalid"); Return false;} return true;
}String. Prototype. Trim = function () {return this. Replace (/(^/S *) | (/S * $)/g ,"");}
// -->
</SCRIPT><Form name = "form1" Action = "restedit. asp" method = "Post" onsubmit = "Return check ()">
<InputName = "textfield1" type = "text" id = "textfield1" size = "5" maxlength = "5" value = "<% = SJ (" qichuang ") %> "onblur =" this. classname = 'input1' "onfocus =" this. classname = 'input1-bor '"/>
<InputName = "textfield11" type = "text" id = "textfield11" size = "5" maxlength = "5" value = "<% = SJ (" zaocaoone ") %> "onblur =" this. classname = 'input1' "onfocus =" this. classname = 'input1-bor '"/>
<InputName = "textfield12" type = "text" id = "textfield12" size = "5" maxlength = "5" value = "<% = SJ (" zaocaotwo ") %> "onblur =" this. classname = 'input1' "onfocus =" this. classname = 'input1-bor '"/> <input name =" Submit "type =" Submit "id =" Submit "value =" complete "/> <input name =" resubmit "type =" reset "id =" resubmit "value =" rewrite all "/> </form>