我使用 Jscript 在 Qualtrics 中启用 Keystrokes 来回答问题。
它与 Qualtrics 示例中提供的 2 个选项一样工作:https ://www.qualtrics.com/university/researchsuite/developer-tools/custom-programming/example-code-snippets/#ExampleJavaScript
我添加了第三个按键选项(按 q),但它不起作用:以某种方式注册了 q 的按键,但它既没有输入数据也没有像按 j 或 k 时那样继续下一个问题。请参阅下面的代码。任何建议表示赞赏 - 谢谢!
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place Your Javascript Below This Line*/
this.hideNextButton();
this.hidePreviousButton();
var that = this;
Event.observe(document, 'keydown', function keydownCallback(e) {
var choiceID = null;
switch (e.keyCode) {
case 74: // 'j' was pressed
choiceID = 1;
break;
case 75: // 'k' was pressed
choiceID = 2;
break;
case 81: // 'q' was pressed
choiceID = 5;
break;
}
if (choiceID) {
Event.stopObserving(document, 'keydown', keydownCallback);
that.setChoiceValue(choiceID, true);
that.clickNextButton();
}
});
});
});