HTML Radio Buttons Change Images
Let's do it again but swap two images this time.
The following snippets are from this page:
A two character label is associated with each image in the
preLoad function. The first character corresponds to the
id of the main image. The second character indicates the new image replacing it. In this example the main image has an
a and the new images replacing it are
input statements in the
body invoke function
im passing the appropriate label. In function
im we concatenate
to the label and evaluate it to obtain the image path. Using the first character of the label (
image) this path is assigned to the main image.
preLoad function references the images before the body executes they will display quickly when the radio button is pressed. Setting
autocomplete="off" in the
form causes it to properly reset if the page is refreshed. I suggest you use your browser to view the source of this page.