实例1
//小时
var timer_h = $('.mdc_mrtpm_Right .timer-item-hour').text().trim();
//分钟
var timer_m = $('.mdc_mrtpm_Right .timer-item-min').text().trim();
//秒数
var timer_s = $('.mdc_mrtpm_Right .timer-item-second').text().trim();
//将时分秒转化为秒
var total_s = Number(timer_h*3600) + Number(timer_m*60) + Number(timer_s);
console.log(total_s);
实例2
var time = '00:02:10';
var hour = time.split(':')[0];
var min = time.split(':')[1];
var sec = time.split(':')[2];
var s = Number(hour*3600) + Number(min*60) + Number(sec);
console.log(s);//130
网友评论