Hello!
We would like to show a series of pictures in random order, with presenting the picture for 50ms, then hiding the picture and displaying a question, when the participant answered, it should move on to the next picture.
So far we implemented that using the random generator function and combining that with a timer (java script).
The is the php code:
// loopPage(48) provides a number between 0 and 48 (plus one at every repetition)
$i = loopPage(48); // Here you can enter the number of images you want to show
// Show the chosen picture
$varID = 'FP01x'.sprintf('%02d', $i + 1); // Variable IDs are FP01x01 to FP01x20
$img = value($varID, 'label');
// The HTML-Tag <img> shows one image, the filename will be shown with src
html('
<div style="margin: 3em; text-align: center">
<img src="'.$img.'" alt="" />
</div>
');
// Create the fitting question ID and show the question using question()
question('EM'.sprintf('%02d', $i + 1))
This is the java script code:
<script type="text/javascript">
<!--
SoSciTools.submitButtonsHide();
SoSciTools.attachEvent(window, "load", function(evt) {
// don't show question and next button
document.getElementById("EM01").style.display = "none";
// Start Timer
window.setTimeout(next, 50);
// Hide picture and show question
document.getElementById("FP01").style.display = "none";
document.getElementById("EM01").style.display
});
</script>
I'm not sure why the time function does not work in terms of displaying/hiding the picture/question? Any help with this would be much appreciated!
Thank you!
All the best,
Hedwig