I’m looking to disable a group of radio buttons which are really images once when of them has been clicked, also a second set of radio buttons (images) are then made visible and enabled below. Here is what I have:
<style type="text/css">
#sub1, #sub2 {
clear:both;
position: relative;
width: 180px;
padding: 10px;
color: Black;
display: none;
}
</style>
<script type="text/javascript">
var chkboxTicked = new Image();
chkboxTicked.src = "../images/star_full.jpg";
var chkboxEmpty = new Image();
chkboxEmpty.src = "../images/star.jpg";
// Needs solution for getElementsByName in IE
function submitcheckboxes(){
var checkboxes = document.getElementsByName("imagecheckboxes");
for(var i in checkboxes){
var location = document.getElementById("form1");
var input = document.createElement('input');
input.setAttribute('style','display:none;');
input.setAttribute('type','hidden');
input.setAttribute('name',checkboxes[i].title);
if(checkboxes[i].src == chkboxTicked.src){
input.setAttribute('value',1);
} else {
input.setAttribute('value',0);
}
location.appendChild(input);
}
return true;
}
function setKeep( elem, groupName )
{
var group = elem.form.elements[groupName],
bool = elem.checked,
i = 0,
rb;
while( rb = group[i++] )
{
rb.disabled = bool;
}
toggleChkBox(this);
}
function toggleChkBox(that){
if(that.src == chkboxEmpty.src){
that.src = chkboxTicked.src;
} else {
that.src = chkboxEmpty.src;
}
// setKeep(this, 'radio');
validate(this);
}
function validate(form) {
// Checking if at least one period button is selected. Or not.
if (document.form1.radio[0].checked ){
setVisibility('sub1', 'none');
setVisibility('sub2','none');
} else {
setVisibility('sub1','inline');
setVisibility('sub2', 'none');
}
}
// need to change for IE
function setVisibility(id, visibility) {
document.getElementById(id).style.display = visibility;
}
</script>
<form name='form1' method=post action=action_page.php onsubmit='return validate(this)'><b>Here is the question </b><br>
<img name="imagecheckboxes" src="../images/star.jpg" name=radio onClick="toggleChkBox(this);" />Answer 1:1
<input type=radio name=radio value='2' onClick="setKeep(this, 'radio');";>Answer 1:2
<input type=radio name=radio value='3' onClick="validate(this)";>Answer 1:3
<input type=radio name=radio value='4' onClick="validate(this)";>Answer 1:4
<input type=reset value=Reset>
<br />
<div id="sub1">
<input type=radio name="radio1" value='5' onClick="validate(this)";>Answer 1a:1
<input type=radio name="radio1" value='6' onClick="validate(this)";>Answer 1a:2
<input type=radio name="radio1" value='7' onClick="validate(this)";>Answer 1a:3
<input type=radio name="radio1" value='8' onClick="validate(this)";>Answer 1a:4
</div>
<div id="sub2">
<input type=radio name="radio2" value='9' onClick="validate(this)";>Answer 1b:1
<input type=radio name="radio2" value='10' onClick="validate(this)";>Answer 1b:2
<input type=radio name="radio2" value='11' onClick="validate(this)";>Answer 1b:3
<input type=radio name="radio2" value='12' onClick="validate(this)";>Answer 1b:4
</div>
</form>
of all the information I can find; this thread has been of particular help:http://www.sitepoint.com/forums/showthread.php?t=123347&highlight=disable+radio+button but also [URL=“http://forums.whirlpool.net.au/forum-replies-archive.cfm/1272828.html”]http://forums.whirlpool.net.au/forum-replies-archive.cfm/1272828.html is of great interest because it identifies the problem with Internet Explorer (all versions) in that it cannot process ‘getElementById’ or ‘getElementByName’…
>> anyone who can help or offer any suggestions regarding these points please step forward <<
_with thanks