a question of javascript DOM functions in IE 6
- by CunruiLi
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
<div id="test">
</div>
<script type="text/javascript">
var check = function(){
alert(document.examsys);
}
var _form = document.createElement("form");
_form.name = "examsys";
_form.action="javascript:;"
for(var i=0 ; i<5; i++){
_form.innerHTML += "<input type='radio' name='answer' value='ccc' /> abc<br />";
}
var submit = document.createElement("input");
submit.type = "image";
submit.src = "tijiao.gif";
submit.alt = "Submit";
if(submit.attachEvent){
submit.attachEvent("onclick",check);
}
else if(submit.addEventListener){
submit.addEventListener("click",check,false);
}
_form.appendChild(submit);
document.getElementById("test").appendChild(_form);
</script>
</body>
</html>
why in IE6 the document.examsys returns "undefined".