Forum Moderators: open
i was wondering if anyone could help me out here.
I have two radio buttons.
One button is marked as checked.
What i want to do is change the CSS style of the label text when either of the buttons is selected.
I have a feeling this will involve javascript.
If anyone could offer their insight i would be gratefull.
Thanks,
Lou
<script type="text/javascript">
<!--
function styleToggle(b) {
for (var i = 0; i< b.form.length; i++) {
if (b.form[i].name == b.name) {
b.form[i].parentNode.style.backgroundColor = b.form[i].checked? 'red' : '';
}
}
}
// -->
</script>
<form>
<label for="but01">
<input type="radio" name="somename" id="but01" value="ho" onclick="styleToggle(this)">
label text here
</label><br>
<label for="but02">
<input type="radio" name="somename" id="but02" value="hi" onclick="styleToggle(this)">
label text here
</label>
</form>