Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<img id='radio' order='1' src='myUnchecked.gif' onclick='doSwap(this)' />One
<img id='radio' order='2' src='myUnchecked.gif' onclick='doSwap(this)' />Two
<img id='radio' order='3' src='myUnchecked.gif' onclick='doSwap(this)' />Three
var imageRadios = new Array();
function getImageRadios()
{
var i_array = document.getElementsByTagName('IMG');
for(var i=0; i<i_array.length; i++)
{
if(i_array[i].id == 'radio') [b]//make the img id's 'radio' for this to work[/b]
imageRadios[imageRadios.length] = i_array[i];
}
[b]//now imageRadios has all the image tags that are radio buttons[/b]
}
var checkedImageRadio = -1;
function doSwap(imageToSwap)
{
for(var i=0; i<imageRadios.length; i++)
{
if(imageRadios[i].order == imageToSwap.order)
{
imageRadios[i].src == 'myChecked.gif';
}
else
{
imageRadios[i].src == 'myUnchecked.gif';
}
}
[b]//using the above-logic makes the images behave like radio buttons in that if you check on an already-checked radio button, it stays checked.[/b]
)
imageRadios[i].src == 'myChecked.gif';
document.formName.hiddenFieldName.value = imageRadios[i].value; [b]//you'll have to give each of the IMG tags a 'value' attribute[/b]