Dynamically swap images based on user interaction

Task:
- Dynamically replace one image on a page with another one.
- Draw a field on the page that is sized for the images you want to display. Let's name it "My Pics"
- Type the following text in the field "My Pics":
<img src="../images/%1" style="width:100%; height:100%;" />
Like this: - Create global variables called img and tmpHTML
- On load page for field "My Pics" . . .
Populate the global variable img with our boiler plate html tag (text of field "My Pics").
NOTE: the not (not) img = false condition evaluates whether the global variable has already been set. The expression will evaluate to true if img has already been set. - Copy all of the images you want to switch between into a folder called images and put the folder in the same folder as your tbk. Then flag that folder for inclusion in your export.
- Draw a list box and type in a list of valid image names.
Something like this: - Create these actions for On select for the list box:
Where pgReplace() parameters look like this:
AND setHTMLContent() parameters look like this: - Export the page; clicking on a image in the list box should dynamically change the image displayed in the field.