It looks like you're new here. If you want to get involved, click one of these buttons!
(set: $robots to "They were each in their own little padded slot. There was something about the way they fitted so snugly which really appealed to $firstname; it was probably why they bought this particular box of robots.")<tw-link class='cyclingLink' data-cycling-texts='["They were each in their own little padded slot. There was something about the way they fitted so snugly which really appealed to $firstname it was probably why they bought this particular box of robots.", "'Good afternoon, boys and girls,' $firstname said absent-mindedly as they waited for the little robots to power up. They said it quietly, to themselves, in the way you might say hello to a magpie.", "$firstname tapped their fingertips on the metal casing as they waited for the robots to boot. They wondered whether they were actually loading up, or if it was just a ploy to make you think there was more in there to load."]' onclick='clickCyclingLink(this, "$robots");'>$robots</tw-link>
Comments
You will need to create that String via concatenation as follows:
Thanks for taking the time to help out.
Within the first (set:) passage the variable works just fine, so the first link shown before you click it has the character's name displayed, rather than just '$firstname'. It's after you click & it uses the text within the
section that it doesn't recognise the variable as anything but plain text. I tried using your concatenation there & it give me an alert box error ('Sorry to interrupt, but this page's code has got itself in a mess. SyntaxError: Unexpected token +'), which I guess was to be expected.
Like I say, I don't know much about coding in any language, so I might be barking up the wrong tree here, but is there a way to make the javascript(?) '<tw-link>' section recognise, or use the info stored in, the twinescript(?) variables?
Again, thanks for your time & any help would be greatly appreciated!
1. Convert the markup for the tw-link into a String literal by wrapping it in quotes, I will be using double quotes.
2. Use the same concatenation technique to append the value of $firstname in each location it is needed.
3. Carefully escape (using as backslash) out all instances of the quotes used in step one (double quotes in the example) that were in the original tw-link markup, you need to do this because you need quotes to represent three different things in the String literal and you only have two type of quotes.
eg. The delimiter of the overall String literal; the delimiter of the tw-link element's property values; the delimiter of each element in the data-cycling-texts property array.
4. Use a (print:) macro to dynamically convert the String literal into markup again.
The end result will look something like the following:
Thank you so much for your time & for sharing your expertise!