私は jsPsych ライブラリを使用して実験をコーディングしています。私はjsに非常に慣れていないので、間違いが明らかな場合はお詫び申し上げます。
入力したテキストを画面に表示しようとしています。これは、作成者が html-keyboard-response プラグインをhtml-keyboard-multiple-responseプラグインに変更した後、この実験で成功しました。
このプラグインを image-keyboard-response と組み合わせて、刺激として html の代わりに画像を使用しようとしました。問題は、html-keyboard-multiple-response とは異なり、入力したとおりにテキストが表示されないことです。キーストロークは最後に displayData() で表示されるため、ログに記録されていることがわかります。
私の適応プラグインはここにあります: jspsych-image-keyboard-multiple-response.js、実験はここにあります: image-keyboard-multiple-response.html。
プラグインをざっと見て、他の 2 つのプラグインを組み合わせる際に何か間違ったコードを書いていないかどうかを確認することはできますか? エラーは、次のようなイメージ プラグインの 83 行目付近にあると思います。
plugin.trial = function(display_element, trial) {
// display stimulus
var html = '<img src="'+trial.stimulus+'" id="jspsych-image-keyboard-multiple-response-stimulus" style="';
if(trial.stimulus_height !== null){
html += 'height:'+trial.stimulus_height+'px; '
if(trial.stimulus_width == null && trial.maintain_aspect_ratio){
html += 'width: auto; ';
}
}
if(trial.stimulus_width !== null){
html += 'width:'+trial.stimulus_width+'px; '
if(trial.stimulus_height == null && trial.maintain_aspect_ratio){
html += 'height: auto; ';
}
}
html +='"></img>';
これは、html プラグインの ~61 行目に対応するものです。
plugin.trial = function(display_element, trial) {
var new_html = '<div id="jspsych-html-keyboard-multiple-response-stimulus">'+trial.stimulus+'</div>';
// add prompt
// if(trial.prompt !== null){
new_html += trial.prompt;
//}
// draw
display_element.innerHTML = new_html;
// store response
var response = {
rt: [],
key: [],
char: []
};
html プラグインで発生するように、入力したとおりにテキストが表示されるように、画像プラグインで変更する必要があるものはありますか?