Showing
1 changed file
with
9 additions
and
4 deletions
@@ -5,8 +5,8 @@ | @@ -5,8 +5,8 @@ | ||
5 | <title>Insert title here</title> | 5 | <title>Insert title here</title> |
6 | </head> | 6 | </head> |
7 | <body> | 7 | <body> |
8 | - <input style="display: none" id="startTime"/> | ||
9 | - <input style="display: none" id="endTime"/> | 8 | + <input style="display: none" id="startTime" type="text"/> |
9 | + <input style="display: none" id="endTime" type="text"/> | ||
10 | 10 | ||
11 | <ul> | 11 | <ul> |
12 | <li> | 12 | <li> |
@@ -33,9 +33,14 @@ | @@ -33,9 +33,14 @@ | ||
33 | { | 33 | { |
34 | var endTime = $('#endTime').val(); | 34 | var endTime = $('#endTime').val(); |
35 | var startTime = $('#startTime').val(); | 35 | var startTime = $('#startTime').val(); |
36 | - var miniteVar = parseInt((endTime - startTime) / 60); | ||
37 | var secondVar = parseInt((endTime - startTime) % 60); | 36 | var secondVar = parseInt((endTime - startTime) % 60); |
38 | - totalVar = miniteVar + '分' + secondVar + '秒'; | 37 | + if (endTime - startTime > 60) { |
38 | + var minuteVar = parseInt((endTime - startTime) / 60); | ||
39 | + totalVar = minuteVar + '分' + secondVar + '秒'; | ||
40 | + } else { | ||
41 | + totalVar = secondVar + '秒'; | ||
42 | + } | ||
43 | + | ||
39 | c=0; | 44 | c=0; |
40 | setTimeout("document.getElementById('total').value=totalVar", 0); | 45 | setTimeout("document.getElementById('total').value=totalVar", 0); |
41 | clearTimeout(t); | 46 | clearTimeout(t); |
-
Please register or login to post a comment