I want to use an image src URL as the state of a tiny state machine to cycle through 4 images, triggered by onClick.
Because i have several of these <img src="..." onClick=""> per row in a table, and many rows,
i am looking for a somewhat generic solution that can be replicated without stepping on the adjacent image selection.
And the final piece of this is, i'd like it to set an input field to the "value" (1..4) currently displaying.
<span onClick="chgState(this)"><img src="images/1.gif"><input type="hidden" name="A_1" > </span>
... B_1 ... B_2
// parse filename and add 1, modulo 4 and set that as the displaying image filename
// then set the input field value to this number
p.s. i suppose if it's easier i could use the <input> field as the state, and then splice in (concatenate) the new value into the filename syntax ("images/"+integer+".gif")