This code works in Firefox but not IE8. The innerHTML shows IE is not giving the radio buttons names making them uncheckable. Is there a workaround or fix? Thanks.
Code:
<script type="text/javascript">
function main()
{
var bodyObj, radObj;
bodyObj = document.getElementsByTagName("body")[0];
radObj = document.createElement("input");
radObj.type = "radio";
radObj.name = "wr1";
radObj.id = "wr1a";
radObj.value = "a";
bodyObj.appendChild(radObj);
alert("name: "+radObj.name+", id: "+radObj.id+", value: "+radObj.value);
radObj = document.createElement("input");
radObj.type = "radio";
radObj.name = "wr1";
radObj.id = "wr1b";
radObj.value = "b";
bodyObj.appendChild(radObj);
alert("name: "+radObj.name+", id: "+radObj.id+", value: "+radObj.value);
alert(bodyObj.innerHTML);
}
</script>
<html><body onload="main()">
</body></html>
Comment