【高手帮助】怎样写一个选择小时,分钟js?不用下拉菜单显示

小时,分钟都用上下箭头选择... 小时,分钟都用上下箭头选择 展开
 我来答
tudou869
2008-04-15 · TA获得超过513个赞
知道小有建树答主
回答量:527
采纳率:0%
帮助的人:355万
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT LANGUAGE="JavaScript">
function add(){
var h = hour.value;
var m = minute.value;
if(m.substring(0,1) == 0){
m = m.substring(1,2);
}
if(h.substring(0,1) == 0){
h = h.substring(1,2);
}
m = m - (-1);
if(m > 59){
m = 0;
h ++;
}
if(h > 23){
h = 0;
}
if(m < 10){
m = "0" + m;
}
if(h < 10){
h = "0" + h;
}
minute.value = m;
hour.value = h;
}
function minus(){
var h = hour.value;
var m = minute.value;
if(m.substring(0,1) == 0){
m = m.substring(1,2);
}
if(h.substring(0,1) == 0){
h = h.substring(1,2);
}
m = m - 1;
if(m < 0){
m = 59;
h --;
}
if(h < 0){
h = 23;
}
if(m < 10){
m = "0" + m;
}
if(h < 10){
h = "0" + h;
}
minute.value = m;
hour.value = h
}
</SCRIPT>
</HEAD>

<BODY>
<input type = "text" id = "hour" value = "10" size = "2" readonly>
<input type = "text" id = "minute" value = "50" size = "2" readonly>
<br>
<input type = "button" id = "add" value = "add" onclick = "add()">
<input type = "button" id = "minus" value = "minus" onclick = "minus()">
</BODY>
</HTML>
//---------------
它们的值你自己设置吧
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式