a question of javascript DOM functions in IE 6

Posted by CunruiLi on Stack Overflow See other posts from Stack Overflow or by CunruiLi
Published on 2010-06-18T06:23:44Z Indexed on 2010/06/18 9:33 UTC
Read the original article Hit count: 229

Filed under:
|
|
<!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' />&nbsp;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".

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dom