/*使用说明：
 首先把本控件包含到页面 
 控件调用函数：MY_GetTime(field)
例如 <input name="time" type="text" onclick="MY_GetTime(this)"/>
*/
var stringtime = "";
document.writeln("<div id=\"_contents\" style=\"padding:6px; background-color:#93beff; font-size: 12px; border: 1px solid #93beff; position:absolute; left:?px; top:?px; width:?px; height:?px; z-index:1; visibility:hidden\">");
stringtime += "\u65f6<select style=\"border: 1px solid #93beff;\" id=\"_hour\">";
for (h = 0; h <= 9; h++) {
stringtime += "<option value=\"0" + h + "\">0" + h + "</option>";
}
for (h = 10; h <= 23; h++) {
stringtime += "<option value=\"" + h + "\">" + h + "</option>";
}
stringtime += "</select> \u5206<select id=\"_minute\" style=\"border: 1px solid #93beff;\">";
for (m = 0; m <= 9; m++) {
stringtime += "<option value=\"0" + m + "\">0" + m + "</option>";
}
for (m = 10; m <= 59; m++) {
stringtime += "<option value=\"" + m + "\">" + m + "</option>";
}
stringtime += "</select> \u79d2<select id=\"_second\" style=\"border: 1px solid #93beff;\">";
for (s = 0; s <= 9; s++) {
stringtime += "<option value=\"0" + s + "\">0" + s + "</option>";
}
for (s = 10; s <= 59; s++) {
stringtime += "<option value=\"" + s + "\">" + s + "</option>";
}
stringtime += "</select> <input name=\"queding\" type=\"button\" onclick=\"_select()\" value=\"\u786e\u5b9a\" style=\"font-size:12px\" /></div>";
document.writeln(stringtime);
var _fieldname;
function MY_GetTime(tt) {
_fieldname = tt;
var ttop = tt.offsetTop; //TT控件的定位点高
var thei = tt.clientHeight; //TT控件本身的高
var tleft = tt.offsetLeft; //TT控件的定位点宽
while (tt = tt.offsetParent) {
ttop += tt.offsetTop;
tleft += tt.offsetLeft;
}
document.getElementById("_contents").style.top = (ttop + thei + 4)+"px";
document.getElementById("_contents").style.left = tleft+"px";
document.getElementById("_contents").style.visibility = "visible";
}
function _select() {
_fieldname.value = document.getElementById("_hour").value + ":" + document.getElementById("_minute").value + ":" + document.getElementById("_second").value;
document.getElementById("_contents").style.visibility = "hidden";
} 