Dear Dominik,
we changed the code to make sure the showContent function is in the beginning. Is the code below right now?
It is still not working, the JavaScript console shows 1 error:
Uncaught SyntaxError: Invalid or unexpected token
with a SoSci link underlined:
https://www.soscisurvey.de/animals_and_people/?q=base&admin&debug&page=11&l=eng
We can't seem to find the what is causing the error...
Best wishes
<script type="text/javascript">
<!--
// Filter function IA01 Compatible
// Filter needs to respond when wrong response is given
// Ignore left-hand option (1) in stimuli 9,10,11,12,13,14,15,16
// If not left-hand then return 0 (go on to next stimulus as if there was no filter)
// Ignore right-hand option (2) in other stimuli
//create array with trials where left-hand response is desired
var I101 = [1,2,3,4,5,6,7,8]
//Create function to show feedback for limited time and hide, feedback = text element with id 'wrong'
function showContent()
{
var content = document.getElementById("wrong");
// restore the normal display mode
content.style.display = "";
// start the timer
window.setTimeout(showContent, 1000); \\ 1 second
// Hide
content.style.display = "none";
}
function selFilter(item, option)
{
//indexOf returns -1 if the number is not found and something other than -1 i it is found
//if the 'item' cannot be found in the variable IA01, so it is a trial where a right-hand response is desired
//and the response was left-handed (option1)
if ( (I101.indexOf(item) == -1) && (option == 1))
{
// Show feedback and ignore answer
showContent()
return -2;
}
//if the 'item' can be found in the variable IA01, so it is a trial where a left-hand response is desired
//and the response was right-handed (option2)
else if ( (I101.indexOf(item) != -1) && (option == 2))
{
// Show feedback and ignore answer
showContent ()
return -2;
}
//otherwise continue with next trial
else
{
return 0;
}
}
SoSciTools.attachEvent(window, "load", function() {
assignmentAB01.setCallbackSelect(selFilter);
});
// -->
</script>