作者 刘晓艳

测试

... ... @@ -358,30 +358,86 @@
})
//倒计时
var times = "60";//倒计时总秒数量
var time="";
function countDown(times) {
var timer = null;
timer = setInterval(function () {
var day = 0,
hour = 0,
minute = 0,
second = 0;//时间默认值
if (times > 0) {
day = Math.floor(times / (60 * 60 * 24));
hour = Math.floor(times / (60 * 60)) - (day * 24);
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if (day <= 9) day = '0' + day;
if (hour <= 9) hour = '0' + hour;
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
//添加一条新语音
var num = 0;
$('.voice_module').on('click', '.add_voice', function () {
// $('.voice_module').append($('.voice_list').html());
// $('.voice_list .voice_first').show()
// $('.add_icon').show()
$('#hour_show').html('<text id="h"></text>' + hour + ':');
$('#minute_show').html('<text></text>' + minute + ':');
$('#second_show').html('<text></text>' + second + '');
$('#second_test').html('<text></text>' + second + '');
//
// console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");
times--;
// var parent = $(this).parents('.voice_module')
// parent.append($('.temp_list').clone());
}, 1000);
// if (times <= 0) {
// clearInterval(timer);
// }
$('.pause').click(function () {
// timer(intDiff);
clearInterval(timer);
localStorage.setItem("times",times)
})
$('.stop').click(function () {
clearInterval(timer);
times=0;
})
$('.stopping').click(function () {
clearInterval(timer);
localStorage.clear()
})
}
// var videolist = $(".voice_module");
// for (var i = 0; i < videolist.length; i++) {
//
// var videoid = $(videolist[i]).attr("video-id");
// if (videoid == title_id) {
// $(videolist[i]).show();
// $(videolist[i]).append($('.voice_list').html());
// $(videolist[i]).children('.voice_list .voice_first').show();
// $('.icon_cancle').show()
// }
// }
$('.start').click(function () {
time=localStorage.getItem("times")
if(time==null){
times = parseInt(60)
}else{
times=time;
}
console.log(time)
// myTimer(intDiff);
countDown(times);
localStorage.setItem("times",times)
})
//添加一条新语音
var num = 0;
$('.voice_module').on('click', '.add_voice', function () {
times=60
// clearInterval(timer);
var day = 0,
hour = 0,
minute = 0,
second = 0;//时间默认值
if (day <= 9) day = '0' + day;
if (hour <= 9) hour = '0' + hour;
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
$('#hour_show').html('<text id="h"></text>' + hour + ':');
$('#minute_show').html('<text></text>' + minute + ':');
$('#second_show').html('<text></text>' + second + '');
num = num + 1
... ... @@ -695,67 +751,7 @@
</script>
<script type="text/javascript">
var times = "60";//倒计时总秒数量
var time="";
function countDown(times) {
var timer = null;
timer = setInterval(function () {
var day = 0,
hour = 0,
minute = 0,
second = 0;//时间默认值
if (times > 0) {
day = Math.floor(times / (60 * 60 * 24));
hour = Math.floor(times / (60 * 60)) - (day * 24);
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if (day <= 9) day = '0' + day;
if (hour <= 9) hour = '0' + hour;
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
$('#hour_show').html('<text id="h"></text>' + hour + ':');
$('#minute_show').html('<text></text>' + minute + ':');
$('#second_show').html('<text></text>' + second + '');
$('#second_test').html('<text></text>' + second + '');
//
// console.log(day + "天:" + hour + "小时:" + minute + "分钟:" + second + "秒");
times--;
}, 1000);
// if (times <= 0) {
// clearInterval(timer);
// }
$('.pause').click(function () {
// timer(intDiff);
clearInterval(timer);
localStorage.setItem("times",times)
})
$('.stop').click(function () {
clearInterval(timer);
times=0;
})
$('.stopping').click(function () {
clearInterval(timer);
localStorage.clear()
})
}
$('.start').click(function () {
time=localStorage.getItem("times")
if(time==null){
times = parseInt(60)
}else{
times=time;
}
console.log(time)
// myTimer(intDiff);
countDown(times);
localStorage.setItem("times",times)
})
</script>
... ...