对于下面的代码,我得到的GameStatsPanel
功能的第二线以下错误:的JavaScript函数原型不能从构造的对象
"Uncaught TypeError: Object #Timer has no method 'start'"
我真的很困惑,为什么这种情况正在发生 - 我有一种感觉我错过了一些简单的地方,但我需要开悟。请随时通过访问www.letsplayglobalgames.com并选择“Play!”来查看问题。选项从主页。让我知道你是否需要更多细节。
function GameStatsPanel() {
this.timer = new Timer();
this.timer.start(); /* error is thrown here */
}
function Timer() {
this.container = document.getElementById('game_time');
this.current_flag_time_start;
this.current_flag_time_stop;
this.time_start = new Date();
this.time_stop;
this.time_difference;
this.current_flag_time_difference;
}
Timer.prototype.start = function() {
this.current_flag_time_start = new Date();
}
难道你创建了'新GameStatsPanel对象()' – Musa 2013-02-21 06:14:14
是的,我的代码: gameStatsPanel =新GameStatsPanel(); – LetsPlayGlobalGames 2013-02-21 06:22:45