我有這樣的Javascript類:的Javascript超時問題
function PageManager() {
this.timeoutHandler = function() {
alert ("hello");
}
this.startTimeout = function() {
this.timeout = setTimeout ("this.timeoutHandler()", 1000);
}
}
當我打電話obj.startTimeout();
我得到這個錯誤:
this.timeoutHandler is not a function
如何調用類函數在超時?
你如何定義'obj'? – Dancrumb 2011-06-09 13:44:48
重複? http://stackoverflow.com/questions/1101668/javascript-howto-use-settimeout-to-invoked-obecjt-itself – SergeS 2011-06-09 13:47:07
是的,對不起。 – Nik 2011-06-09 13:48:16