I have a radio button that is controlling the showing/hiding of a div selection table, but on the initial load, it is not showing/hiding correctly based on the value of that radio button. (see attachment below) The alert I put in the function doesn’t even occur. 😡
The radio button works properly afterward, just not the initial load.
PLEASE help, and let me know what I have wrong….
[CODE]
<html>
<head>
<script language=”JavaScript”>
function ExposeList() {
var status = document.getElementByName(‘VIOLATIONS’);
alert(“alert here”);
for(var i = 0; i < 2; i++ ) {
alert(status[i].value);
if (status[i].value == “Y”) { document.getElementById(‘ScrollCB’).style.display = “block”; }
else { document.getElementById(‘ScrollCB’).style.display = ‘none’; }
}
function YesAnswer() {
document.getElementById(‘ScrollCB’).style.display = “block”;
}
function NoAnswer() {
document.getElementById(‘ScrollCB’).style.display = ‘none’;
}
</script>
</head>
<body onload=”ExposeList();”>
.
.
.
div code…
[CODE]
<input onclick=”YesAnswer()” type=”radio” ${disabled(‘VIOLATIONS’)} ${checked(‘VIOLATIONS’,row.VIOLATIONS,’Y’)} name=”VIOLATIONS” value=”Y” />Yes
<input onclick=”NoAnswer()” type=”radio” ${disabled(‘VIOLATIONS’)} ${checkeddft(‘VIOLATIONS’,row.VIOLATIONS,’N’)} name=”VIOLATIONS” value=”N” />No
<div id=”ScrollCB” OVERFLOW: auto; WIDTH: 200px; HEIGHT: 105px”>
<input id=”VSPEED” type=”checkbox” ${disabled(‘VSPEED’)} ${checked(‘VSPEED’,row.VSPEED,’X’)} name=”VSPEED” value=”X” />Excessive Speed<br />
<input id=”VTOOCLOSE” type=”checkbox” ${disabled(‘VTOOCLOSE’)} ${checked(‘VTOOCLOSE’,row.VTOOCLOSE,’X’)} name=”VTOOCLOSE” value=”X” />Follows Too Close<br />
.
.
<input id=”VOTHER” type=”checkbox” ${disabled(‘VOTHER’)} ${checked(‘VOTHER’,row.VOTHER,’X’)} name=”VOTHER” value=”X” />Other<br />
</div>
[ATTACH]11095[/ATTACH]
[upl-file uuid=604a2a23-6b8f-420e-8eba-8cc9a3f27ac4 size=24kB]Driver Violations.pdf