There are many problems with this code.
Code:
<script language="javascript">
language is deprecated for type.
Code:
if(document.form1.r[i].checked)
Forms may not be accessible as properties of document. You should use the document.forms collection.
Code:
<input name="r" type="radio" value="0" onClick="callMe()">No
There are more ways to select a radio button than a click (onchange should work, but unfortunately doesn't in [wait for it...] IE).
Code:
<script type="text/javascript">
function callback() {
alert("Your message here");
}
function getRadioValue(el) {
if(!el.length) return null;
for(var i = 0; i < el.length; ++i)
if(el[i].checked) return el[i].value;
return null;
}
window.onload = function() {
for(var i = 0, f = document.forms['form1'].elements; i < f.length; ++i)
f[i].onclick = f[i].onchange = f[i].onkeypress = function() {
var f = this.form.elements;
if(getRadioValue(f.r) === "0" && getRadioValue(f.r1) === "0" && getRadioValue(f.r2) === "0")
callback();
};
};
</script>
Bookmarks