我正在开发一个基于Web的应用程序来捕获系统日期时间的开始时间和结束时间,但我的主要问题是我不知道如何获得停机时间,开始和结束时间之间的持续时间.
//Function to get current start time
var startTime = setInterval(function () { start() }, 1000);
function start() {
var startDate = new Date();
var timeStart = startDate.toLocaleTimeString();
$("#setCount").html(timeStart);
}
Run Code Online (Sandbox Code Playgroud) 是否可以在PhoneGAP中使用CSS切换按钮?我想要一个按钮,如果点击它会改变颜色,再次点击它必须回到默认颜色.知道怎么做吗?
我已经编辑了我的帖子,我们很容易帮助我,因为现在我真的很困惑如何做到这一点,简单的东西,但技巧.
`This the function
function toggle(ths) {
//CSS color
$(ths).toggleClass("btnColor");
$("#tb").toggleClass("btnColorR")
//Get value clicked
var clicked = $(ths).val();
//diplay on web-page
$("#lblType").html(clicked);
$("#setCount").html(" minutes : " + minutes + " seconds : " + seconds);
//duration time count
seconds = seconds + 1;
if (seconds % 60 == 0) {
minutes += 1;
seconds = 0;
}
timer = setTimeout("toggle()", 1000);
}
The CSS
.btnColor
{
background-color:blue;
color:white;
}
.btnColorR {
background-color:green;
}
This is how my buttons are …Run Code Online (Sandbox Code Playgroud)