IE升级代码时邮件内容

  • TypeErrorUnable to set property 'value' of undefined or null reference.

但是可以进入添加页面,填完信息后,submit后跳转至 错误页面,(Unknown system error)

参考解决方案:

http://*.com/questions/21775185/error-unable-to-set-property-value-of-undefined-or-null-reference

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError

  最终是因为:替换之后name要换成id.

 <%--var hidden = document.createElement("<input type='hidden' name='<%=myid>'>");--%>
     var hidden=document.createElement("input");
     hidden.setAttribute("type","hidden");
     hidden.setAttribute("id","myid");
     obj.appendChild(hidden);
  • Unable to get property 'substring' of undefined or null reference

    解决:  document.getElementsByName("startDate").value != '' && document.getElementsByName("endDate").value != '';

后面要加下标,如getElementsByName("")[0].value;

  • Unable to get property 'style' of undefined or null reference

   解决:document.getElementById.iframe1.style.display='none';

  • Unable to set property 'disabled' of undefined or null reference

   解决:document.form1.birthDayStr.disabled= true;

PS. <form name="form1"

  • 系统中在升级前就存在的document.getElementById(),某些在IE11中并不支持
  IF :
      form1.actionType.value = "searchResult";
 THEN:
      var form1 = document.getElementsByName("form1")[0];
  Other points Similar  
  • onclick()内的函数报_submitQuery is undefined
 function _submitQuery(){
  if(!_checkQuery()){
  alert("-----");
 }
     return
 }

原因:_checkQuery()内的一个getElementsByName的一个下标为[],未加0;

  • 报Function expected

  原因:IE11不支持【document.frames("pendingActivities")】用法。

function doRediary(){
var radios=doucment.frames("pendingActivities").document.getElemntsByName("selectedActivities");
}

  替换为:

function doRediary(){
var radios=doucment.frames["pendingActivities"].document.getElemntsByName("selectedActivities");
}

  技术来源:blog.sina.com.cn/s/blog_74924f2401017t0a.html

  • dispatchEvent-onchange,onmousedown,onblur,onclick适应IE11写法。
 var event1 = document.createEvent('HTMLEvents');
  event1.initEvent("change", true, true);
  obj.dispatchEvent(event1);

  var event1 = document.createEvent("MouseEvents");
   event1.initMouseEvent("mousedown", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
   document.body.dispatchEvent(event1);    

 var evt2 = document.createEvent("MouseEvent");
  evt2.initMouseEvent("blur", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
  document.body.dispatchEvent(evt2);

 var evt2 = document.createEvent("MouseEvent");
  evt2.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
  document.body.dispatchEvent(evt2);
  • style属性

不支持这种写法:

 style='display: "none"'

支持下面写法:

 style="display: none"

持续更新;

上一篇:JavaScript禁用回退


下一篇:VC++ MFC中如何将应用程序的配置信息保存到注册表中(二)