Explore the community Forums Lectora Lectora Questions & Answers Change text color in a script … is impossible? Or something? Reply To: Change text color in a script … is impossible? Or something?

#384033 Score: 0
Profile photo of Jason Dalrymple
Jason Dalrymple
Member
beginner
intermediate
profile
wise owl
curious george
contributor
friend finder
advanced
picture perfect
54 pts
@JasonADal

Hi Carl – Based on what you’re trying to accomplish, the “%HTMLNAME%” token selector won’t work. The selector only works when the action is on the object itself.

Even when using the selector, you may still have to add the value in the tag for the element. Buttons, images, shapes, for example, need “btn” or “anc” respectively in order to change the style:

document.getElementById(“%HTMLNAME%btn”).style.border=”red”;

That works if the action is on the button itself. However, if you have an action on a different element triggering the change, you need the exact HTML name of the target. If the above button is “button12345”, you need to use that in place of the %HTMLNAME%.

Since you’re triggering the changes from events on the audio, you’ll need to get use the exact HTML name from the description in the Properties ribbon.

I was able to get changes to the background and border of the question texts synced with audio, but am stumped on how to target the font color of a text block. The font color is a style attribute on the span class, and I’m not having any luck with research I’ve done that allow it to change with a synced audio event.