I did not find the "hour, minute, and second" control on the Internet for a long time. I made it myself and sent it here for convenience.
Effect of Mouse clicking
SetTime. js
Copy codeThe Code is as follows:
/**//***********************************
* Instructions:
* First, include the control to the page.
* <Script src = "XXX/setTime. js" type = "text/javascript"> </script>
* Control call function: _ SetTime (field)
* For example, <input name = "time" type = "text" onclick = "_ SetTime (this)"/>
*
************************************/
Var str = "";
Document. writeln ("<div id =/" _ contents/"style =/" padding: 6px; background-color: # E3E3E3; font-size: 12px; border: 1px solid #777777; position: absolute; left :? Px; top :? Px; width :? Px; height :? Px; z-index: 1; visibility: hidden/"> ");
Str + = "/u65f6 <select name =/" _ hour/"> ";
For (h = 0; h <= 9; h ++ ){
Str + = "<option value =/" 0 "+ h +"/"> 0" + h + "</option> ";
}
For (h = 10; h <= 23; h ++ ){
Str + = "<option value =/" "+ h +"/">" + h + "</option> ";
}
Str + = "</select>/u5206 <select name =/" _ minute/"> ";
For (m = 0; m <= 9; m ++ ){
Str + = "<option value =/" 0 "+ m +"/"> 0" + m + "</option> ";
}
For (m = 10; m <= 59; m ++ ){
Str + = "<option value =/" "+ m +"/">" + m + "</option> ";
}
Str + = "</select>/u79d2 <select name =/" _ second/"> ";
For (s = 0; s <= 9; s ++ ){
Str + = "<option value =/" 0 "+ s +"/"> 0" + s + "</option> ";
}
For (s = 10; s <= 59; s ++ ){
Str + = "<option value =/" "+ s +"/">" + s + "</option> ";
}
Str + = "</select> <input name =/" queding/"type =/" button/"onclick =/" _ select () /"value =/"/u786e/u5b9a/"style =/" font-size: 12px/"/> </div> ";
Document. writeln (str );
Var _ fieldname;
Function _ SetTime (tt ){
_ Fieldname = tt;
Var ttop = tt. offsetTop; // The positioning height of the TT Control
Var thei = tt. clientHeight; // The height of the TT control itself
Var tleft = tt. offsetLeft; // The positioning point width of the TT Control
While (tt = tt. offsetParent ){
Ttop + = tt. offsetTop;
Tleft + = tt. offsetLeft;
}
Document. all. _ contents. style. top = ttop + thei + 4;
Document. all. _ contents. style. left = tleft;
Document. all. _ contents. style. visibility = "visible ";
}
Function _ select (){
_ Fieldname. value = document. all. _ hour. value + ":" + document. all. _ minute. value + ":" + document. all. _ second. value;
Document. all. _ contents. style. visibility = "hidden ";
}