【发布时间】:2019-07-31 02:37:20
【问题描述】:
我希望它在窗口打开 20 秒后自动按下确定按钮。 我不知道该怎么做。 代码是:
window_NameInput.prototype.processHandling = function() {
if (this.isOpen() && this.active) {
if (Input.isRepeated('ok')) {
this.processOk();
}
}
};
我尝试了什么:
window_NameInput.prototype.processHandling = function() {
if (this.isOpen() && this.active) {
{ setTimeout(function () if (Input.isRepeated('ok')) {
this.processOk();
} , 20000); }
}
};
编辑:
我实际上决定在下面使用此代码。我想在窗口打开 20 秒后调用 ok 处理程序。
Window_NameInput.prototype.processHandling = function() {
if (this.isOpen() && this.active) {
setTimeout(function(){
this.callOkHandler();
},2000);
}
};
但是我得到了未捕获的类型错误 this.callokhandler is not a function
任何帮助表示感谢提前感谢
【问题讨论】:
-
setTimeout() 回调中的简单错字。
-
我已经编辑了问题,我决定使用不同的代码,我得到了未捕获的类型错误 this.callokhandler is not a function,你知道如何解决这个问题吗?
标签: javascript time set out