html5js实现正计时,在Html5中js怎么设置正计时开始
這個(gè)是Html5的一個(gè)程序。我從網(wǎng)上拷貝下來(lái)的。現(xiàn)在打開(kāi)后就是別人的計(jì)時(shí),請(qǐng)問(wèn)怎么變成讓別人點(diǎn)擊后計(jì)時(shí)再重新開(kāi)始。然后就一直計(jì)時(shí)下去,其他人打開(kāi)時(shí)依然是第一次點(diǎn)擊時(shí)的計(jì)時(shí)。
這個(gè)是代碼:
Our Love Story@font-face {
font-family: digit;
src: url('digital-7_mono.ttf') format("truetype");
}
/**
* We are both Fudan SSers and programmers,
* so I write some code to celebrate our 1st anniversary.
*/
Boy i = new Boy("hackerzhou");
Girl u = new Girl("MaryNee");
// Nov 2, 2010, I told you I love you.
i.love(u);
// Luckily, you accepted and became my girlfriend eversince.
u.accepted();
// Since then, I miss u every day.
i.miss(u);
// And take care of u and our love.
i.takeCareOf(u);
// You say that you won't be so easy to marry me.
// So I keep waiting and I have confidence that you will.
boolean isHesitate = true;
while (isHesitate) {
i.waitFor(u);
// I think it is an important decision
// and you should think it over.
isHesitate = u.thinkOver();
}
// After a romantic wedding, we will live happily ever after.
i.marry(u);
i.liveHappilyWith(u);
Minyue, I have fallen in love with you for
Love u forever and ever.
- hackerzhouInspired by FlowerPower project.
Copyright ? 2011 hackerzhou.me 2009-2011
var offsetX = $("#loveHeart").width() / 2;
var offsetY = $("#loveHeart").height() / 2 - 55;
var together = new Date();
together.setFullYear(2010, 10, 2);
together.setHours(20);
together.setMinutes(0);
together.setSeconds(0);
together.setMilliseconds(0);
if (!document.createElement('canvas').getContext) {
var msg = document.createElement("div");
msg.id = "errorMsg";
msg.innerHTML = "Your browser doesn't support HTML5!
Recommend use Chrome 14+/IE 9+/Firefox 7+/Safari 4+";
document.body.appendChild(msg);
$("#code").css("display", "none")
$("#copyright").css("position", "absolute");
$("#copyright").css("bottom", "10px");
document.execCommand("stop");
} else {
setTimeout(function () {
startHeartAnimation();
}, 5000);
timeElapse(together);
setInterval(function () {
timeElapse(together);
}, 500);
adjustCodePosition();
$("#code").typewriter();
}
分享至:
總結(jié)
以上是生活随笔為你收集整理的html5js实现正计时,在Html5中js怎么设置正计时开始的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: ELK 环境搭建 (四)
- 下一篇: 启动vsftpd失败是什么原因_Cent