感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
<div>
<div class="item">
<p>
BREAK LENGTH
</p>
<button value="-">
-
</button>
<input type="text" value = "5" id="break" readonly/>
<button value="+">
+
</div>
SESSION LENGTH
<input type="text" value = "25" id="session" disabled="disabled"/>
<h4>
SESSION
</h4>
<input type="text" id="clock" value="25:00" readonly/>
xxxxxxxxxx
var timeon=false;
$("input#clock").click(function(){
if(timeon==false){
tik();
timeon=true
}
else
{clearTimeout(t);
var value = $("input#session").val();
$("input#clock").val(value+":00");
timeon=false;}
})
function tik(){
var mintue = parseInt($("input#clock").val().substring(0,2));
var second = parseInt($("input#clock").val().substring(3));
if (second||mintue){
if (second==0){
second = 60;
mintue =mintue-1;
mintue = checkTime(mintue);
second = checkTime(second-1);
$("input#clock").val(mintue+":"+second);
t = setTimeout("tik()",1000);
change();
function change(){
var text = $("h4").text();
if (text=="SESSION")
{
$("h4").text("BREAK");
var value = $("input#break").val();
$("h4").text("SESSION");
function checkTime(i)
if (i<10)
{i="0" + i}
return i
$("button").click(function(){
if ($(this).val()=="+")
var time=$(this).prev().val();
time = parseInt(time)+1;
$(this).prev().val(time)}
else{
var time=$(this).next().val();
time = parseInt(time)-1;
$(this).next().val(time)
if(timeon==true)
clearTimeout(t);
div{
width:500px;
margin:auto;
.item{
float:left;
width:250px;
text-align:center;
input{
border:none;
width:50%;
font-size:1.5em;
button{
input#clock{
width:300px;
height:300px;
border: 2px solid #99CC00;
border-radius:50%;
cursor:pointer;
h4{
clear:both;
*{
background-color:#333333;
color:#FFFFFF;
font-family: Open Sans,Arial;