我試圖創建多個定時器。任何教程,可以幫助我。最困難的部分是html部分,以及如何鏈接我的文件一個示例項目會對我很好。C#,MVC,骨幹,定時器
Html5.Views.Timer = Backbone.View.extend({
el: 'div#timer',
initialize: function() {
timer = this.model;
this.render();
},
events: {
"clicked div#add_time": "update_timer"
}
render: function() {
$(this.el).append(HandlebarsTemplates['timer'](timer);
this.start_timer();
},
start_timer: function() {
clearTimeout(this.main_timer);
this.main_timer = setTimeout(function() {
if (this.countDownInstance) {
this.countDownInstance.clearRewriteCounter();
}
this.countDownInstance = new countDown(timed.length, 'main_timer');
}, timed_length*1000);
},
update_timer: function() {
timed.length = timed.length+30
this.start_timer();
}
});
不要重新發布的問題。 – Will 2012-04-01 04:18:33