Home > Web Front-end > JS Tutorial > Use js to implement button control text box plus 1 minus 1 to apply to hours and minutes_javascript skills

Use js to implement button control text box plus 1 minus 1 to apply to hours and minutes_javascript skills

WBOY
Release: 2016-05-16 17:10:01
Original
1126 people have browsed it

time.html代码:

复制代码 代码如下:









Document

















time.js代码:
复制代码 代码如下:

function add_num(a,b,c){

if(cc ;
}
else{
c=b;
}
if(c<=9&&c>=0){
c="0" c;
}
return c;
}
function sub_num(a,b,c){
if(c>a){
c--;
}
else{
c=b;
}
if(c<=9&&c>=0){
c="0" c;
}
return c;
}
function add_hour(){
var current_num=$("#hour").attr("value");
current_num=add_num(23,0,current_num);
$("#hour").attr("value",current_num);
}
function sub_hour(){
var current_num=$("#hour").attr("value");
current_num=sub_num(0,23,current_num);
$("#hour").attr("value",current_num);
}
function add_minute(){
var current_num=$("#minute").attr("value");
current_num=add_num(59,0,current_num);
$("#minute").attr("value",current_num);
}
function sub_minute(){
var current_num=$("#minute").attr("value");
current_num=sub_num(0,59,current_num);
$("#minute").attr("value",current_num);
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template