I'm planning to run my thesis experiment on Qualtrics (& MTurk). I have no knowledge in programming and I hope someone here can help me...
My experiment invoves a face categorization task: on each trial, a fixation cross (image) apears on the screen for 1 second (1000 ms), then a face (image) is presented until response (key press), then the face immediately disapears and the fixation shows again. The face images are located in the qualtrics graphic library and are loaded via loop & merge. Each image (fixation/face) is presented on a seperate page, so (I guess?) switching images invoves loading the next page.
A friend wrote me a code (see below). Because somtimes the face images takes time to load, he programmed the code so that the fixation image will stay on the screen until the a face image is loaded. Before he did this everything took even longer.
So, the problem: it's really important that the timing will be right (1 sec and immediate fading) and right now is't not (the fixation image stays for much longer than 1 sec and the face image doesnt disapear immediately after the key press). Is there any way to fix this?
Here is a preview of the task: https://az1.qualtrics.com/WRQualtricsSurveyEngine/?SID=SV_86ywmGzJI6CYCaN&SVID=&Preview=Block&ID=BL_cZlpjflHvRNvLF3&Q_DONT_SAVE=1
And the code:
Qualtrics.SurveyEngine.addOnload(function()
{
this.hideChoices()
$('NextButton').hide();
var formPage = this;
var c = 0;
change2face = function() {
if($('face_img').naturalWidth === 0) {
window.setTimeout(change2face,100);
} else {
$('plus_img').hide();
$('face_img').style.display = "inline";
Event.observe(document, 'keydown', function keydownCallback(e) {
//Get char from the pressed key keycode
c = String.fromCharCode(e.keyCode);
if (c == 'Q') {
Event.stopObserving(document, 'keydown', keydownCallback);
formPage.setChoiceValue(1,'true');
formPage.clickNextButton();
}
if (c == 'P') {
Event.stopObserving(document, 'keydown', keydownCallback);
formPage.setChoiceValue(2,'true');
formPage.clickNextButton();
}
});
}
}
window.setTimeout(change2face,1000);
});
Thanks,
-Mayan