Сообщение от bayanruby
|
норм?
|
нормально
<!DOCTYPE>
<html>
<head>
<title></title>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function ()
{
var timers, ret;
$(":button")
.click(function ()
{
$(this)
.val("\u25b6" == $(this)
.val()? "\u25fc": "\u25b6")
.prev()
.data(
{
timer: (new Date)
.getTime()
}
)
.toggleClass("timer");
timers = $(".timer");
timers.size() && Timer()
}
);
function two(a) {
return (9 < a? "": "0") + a
}
function formatTime(a) {
a = Math.floor(a / 1E3);
var b = Math.floor(a / 60),
c = Math.floor(b / 60);
a %= 60;
b %= 60;
return two(c) + " : " + two(b) + " : " + two(a)
}
function Timer() {
window.clearTimeout(ret);
timers.each(function (a, b)
{
var c = (new Date)
.getTime() - $(b)
.data("timer") | 0,
c = formatTime(c);
$(b)
.html(c)
}
);
timers.size() && (ret = window.setTimeout(Timer, 1000))
};
}
);
</script>
</head>
<body>
<span >00 : 00 : 00</span><input name="" type="button" value="▶"><br>
<span >00 : 00 : 00</span><input name="" type="button" value="▶"><br>
<span >00 : 00 : 00</span><input name="" type="button" value="▶"><br>
</body>
</html>