How to change the color of the word of a passage after clicking the word?


How to change the color of the word of a passage after clicking the...
Author
Message
yihuanlai
yihuanlai
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 7, Visits: 44
Hi all,

Here is what I want to do. I want to provide participants a passage that contains many grammar errors. The participants will click on the words that they think are wrong. The color of the word will change to red if they click it and the word will change back to black if they click it again. 

I've figured out how to change the color of the word by entering the following code. For example, the sentence is "My first visit to Singapore was...", and I have to write a code for every single word. And in inquisit, the distance between the words are not exactly, so the form of the sentence looks really strange.

So I don't want to write a code for each single word.
Is there a code that I could just put my whole passage in and any word of the passage will change its color after clicking?

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulusframes = [1=word01,word02,word03,word04,word05,word06]
/ inputdevice = mouse
/ validresponse = (word01,word02,word03,word04,word05,word06)
/ ontrialend = [if(trial.mytrial.response=="word01")
  text.word01.textcolor=sequence(red,black)]
/ ontrialend = [if(trial.mytrial.response=="word02")
  text.word02.textcolor=sequence(red,black)]
/ ontrialend = [if(trial.mytrial.response=="word03")
  text.word03.textcolor=sequence(red,black)]
/ ontrialend = [if(trial.mytrial.response=="word04")
  text.word04.textcolor=sequence(red,black)]
/ ontrialend = [if(trial.mytrial.response=="word05")
  text.word05.textcolor=sequence(red,black)]
/ ontrialend = [if(trial.mytrial.response=="word06")
  text.word06.textcolor=sequence(red,black)]
/ branch = [if(trial.mytrial.response!="done")trial.mytrial]
</trial>

<text word01>
/ items = ("My")
/ txcolor = black
/ erase = false
/ size = (5%,4%)
/ position = (10%,20%)
</text>

<text word02>
/ items = ("first")
/ txcolor = black
/ erase = false
/ size = (5%,4%)
/ position = (14%,20%)
</text>

<text word03>
/ items = ("visit")
/ txcolor = black
/ erase = false
/ size = (5%,4%)
/ position = (19%,20%)
</text>

<text word04>
/ items = ("to")
/ txcolor = black
/ erase = false
/ size = (5%,4%)
/ position = (24%,20%)
</text>


<text word05>
/ items = ("Singapore")
/ width = 100%
/ txcolor = black
/ erase = false
/ size = (5%,4%)
/ position = (28%,20%)
</text>

<text word06>
/ items = ("was")
/ txcolor = black
/ erase = false
/ size = (5%,4%)
/ position = (35%,20%)
</text>

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search