Hi,
I have the following script in the footer of a select question - it is to grey out the checkbox labels when the "None of these" option is selected (per to my previous question, as I had no answers, I'm trying this myself!):
<script type="text/javascript">
var TS = new Array;
TS[0]= document.getElementsByTagName("label")[0];
TS[1]= document.getElementsByTagName("label")[1];
TS[2]= document.getElementsByTagName("label")[2];
TS[3]= document.getElementsByTagName("label")[3];
TS[4]= document.getElementsByTagName("label")[4];
TS[5]= document.getElementsByTagName("label")[5];
TS[6]= document.getElementsByTagName("label")[6];
window.onload = function() {
document.getElementById("A3_8").onclick = changeColor;
}
function changeColor(){
if (document.getElementById("A3_8").checked) {
for (var i=0; i<=(6); i++){ TS[i].style.backgroundColor="#CFCFCF"; }
} else if (document.getElementById("A3_8").unchecked) {
for (var i=0; i<=(6); i++){ TS[i].style.backgroundColor=""; }
}
}
</script>
As the heading suggests, this is working when I preview the page, but not when uploaded into a browser. What am I missing? Please help!
Javascript working in preview, but not in browser
Resolved
1 reply