I'm working on experiment about distractions. As part of the experiment, I need a question to appear on the screen for two seconds, disappear for two seconds, then reappear. Here's my shot at programming this in javascript.
Qualtrics.SurveyEngine.addOnload(function()
{
function togglequestion() {
if(this.getQuestionDisplayed()) {
this.questionContainer.style.display = 'none';
} else {
this.questionContainer.style.display = 'block';
}
};
var a1 = setTimeout(togglequestion, 2000);
var a2 = setTimeout(togglequestion, 4000);
});
I think the problem is either in the way I'm declaring my function, or the if statement. I'm not very experienced with javascript so any bit of help would be very appreciated!