自己在网上找了半天没找到只有 “时分秒”的控件, 就自己做了个,发在这里方便有人用到
鼠标点击 后 的效果
SetTime.js
复制代码 代码如下:
/**//***********************************
* 使用说明:
* 首先把本控件包含到页面
* <script src="https://www.jb51.net/XXX/setTime.js" type="text/javascript"></script>
* 控件调用函数:_SetTime(field)
* 例如 <input type="text" />
*
************************************/
var str = "";
document.writeln("<div id=https://www.jb51.net/"_contents/" style=https://www.jb51.net/"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=https://www.jb51.net/"_hour/">";
for (h = 0; h <= 9; h++) {
str += "<option value=https://www.jb51.net/"0" + h + "https://www.jb51.net/">0" + h + "</option>";
}
for (h = 10; h <= 23; h++) {
str += "<option value=https://www.jb51.net/"" + h + "https://www.jb51.net/">" + h + "</option>";
}
str += "</select> /u5206<select name=https://www.jb51.net/"_minute/">";
for (m = 0; m <= 9; m++) {
str += "<option value=https://www.jb51.net/"0" + m + "https://www.jb51.net/">0" + m + "</option>";
}
for (m = 10; m <= 59; m++) {
str += "<option value=https://www.jb51.net/"" + m + "https://www.jb51.net/">" + m + "</option>";
}
str += "</select> /u79d2<select name=https://www.jb51.net/"_second/">";
for (s = 0; s <= 9; s++) {
str += "<option value=https://www.jb51.net/"0" + s + "https://www.jb51.net/">0" + s + "</option>";
}
for (s = 10; s <= 59; s++) {
str += "<option value=https://www.jb51.net/"" + s + "https://www.jb51.net/">" + s + "</option>";
}
str += "</select> <input name=https://www.jb51.net/"queding/" type=https://www.jb51.net/"button/" onclick=https://www.jb51.net/"_select()/" value=https://www.jb51.net/"/u786e/u5b9a/" style=https://www.jb51.net/"font-size:12px/" /></div>";
document.writeln(str);
var _fieldname;
function _SetTime(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.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";
}
您可能感兴趣的文章:
相关文章
最新评论
站长推荐 正版Windows 10 家庭/专业版,操作系统限时抢购[¥1088→¥248] 站长推荐 Microsoft Office 2016/2019/365 正版最低价仅需[ ¥148元]
大家感兴趣的内容
最近更新的内容
常用在线小工具