Forum Moderators: phranque
In other words, a check box would be selected and an image would appear. If the selected a different radio button in the group the image would be replaced.
Confused? Its hard to explain
Here's the javascript, put it in the head:
function toggle(obj){
var theimageID = obj.id + 'IMG' ;
if(obj.checked){
document.getElementById(theimageID).style.display = "inline";
}else{
document.getElementById(theimageID).style.display = "none";
}}
Define your images and checkboxes like so (be sure to add the form tags):
<input type="checkbox" id="pepperoni" onClick="toggle(this);">pepperoni<br />
<input type="checkbox" id="mushroom" onClick="toggle(this);">mushroom<br />
<img id="pepperoniIMG" src="pepperoni.gif" style="display:none;">
<img id="mushroomIMG" src="mushroom.gif" style="display:none;">
You should now have pizza ingredient checkboxes that cause little images of the ingredient to appear. ;)