I get an error in the FF javascript: console with this code. ?
[code=php]
<html>
<head>
<title>Radio Button Test</title>
<script type=”text/javascript”>
<!–
function getSWKrb() {
var len = document.getElementById(‘SWK’).length;
for (var i=0; i<len; i++) { if (document.getElementById(‘SWK’)[i].checked) { break } }
return document.getElementById(‘SWK’)[i].value;
}
//–>
</script>
</head>
<body>
<h2>Radio Button Test</h2>
<p />
<script type=”text/javascript”>
<!–
document.write(“<br />For: Week #”);
for (i=1; i<20; i++) {
var s = “<input type=’radio’ id=’SWK’ name=’SWK’ value='”+i+”‘”;
if (i==1) { s += ” checked”; }
document.write(s+’>’+i);
}
//–>
</script>
<p />
<button id=’btn’ onClick=”document.getElementById(‘showRBset’).value=getSWKrb()”>Get setting</button>
<input type=”text” id=”showRBset” value=””>
</body>
</html>
What can I change to avoid the dreaded:
document.getElementById(“SWK”)[i] has no properties error in Line 9?