Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Is it by any means possible to make custom radio buttons on webpages?
You know like, i have 3 images, one for unchecked, one for checked, and one for when its clicked, and then you set up some javascript/php/html/css/dhtml whatever so that all radio buttons appear like the images.
Thanks in advance

You can't use custom images for radio buttons. But, you can create some programming (JavaScript/DHTML) such that they act like radio buttons. And you could also program it so that it sets the value you want to pass.

It would not be entirely complex, but would take a little while to code. But, here are some ideas off the top of my head.
1. Use a hidden field to hold the value of the checked option (set the default value here if there will be one).
[input type="hidden" name="optVal" value="defaultVal"]
2. For each option use something like this below for the custom radio button image.
[img src="uncheckImg.jpg" onClick="setRadio(this.id,'thisOptionsValue')" id="opt0"]
3. Create the function setRadio() to change the custome radio button images and to set the hidden fields value.
function setRadio (fieldID,fieldVal) {
//Set all fields to unchecked
for (i=0; i<numberOfOptions ;i++) {
document.getElementById('opt'+i).image.src=uncheckImg.jpg;
}//Sett the checked field img and value
document.getElementById(fieldID).image.src=checkImg.jpg;
document.forms[0].optVal.value = fieldVal;
}This is all just off the top of my head. There might be some validations that you should include as well. Try to start the code and post back if you hit any snags. Use the Alert Me feature and I will be more likely to respond.
Michael J

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |