展开全部
<!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>
//---------------
它们的值你自己设置吧
<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>
//---------------
它们的值你自己设置吧
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询