Recently encountered a problem in the project, there is a asp.net web program can only run in IE7, now xp are eliminated, everyone uses IE8-IE11, so this web app also needs to upgrade to adapt to all IE versions. According to the incompatibility of IE, the document. createElement method is called, for example:
Function addStyleNo (value, cannotDel ){
If (! Value ){
Value = '';
}
Var tb = $ ('tbodystyle ');
Var tr = tb. insertRow ();
Var td1 = tr. insertCell ();
Td1.style. width = '20px ';
Td1.style. height = '20px ';
If (! CannotDel ){
Var imgDel = document. createElement ("");
Td1.appendChild (imgDel );
}
Var td2 = tr. insertCell ();
Td2.style. height = '20px ';
Var txt = document. createElement ("");
Td2.appendChild (txt );
}
There are too many js files in this system, and you are not familiar with the business of this system. I used to replace this document. createElement with jquery,
Var imgDel = jq ("") [0];
Var txt = jq ("") [0];
Later I found that there were too many places to change. So think about whether there is a simple method, and finally point the finger to overwrite the implementation of the document. createElement method.
Document. createEl = document. createElement;
Document. createElement = function (obj ){
If (obj. toString (). indexOf ("<")>-1 ){
Return jq (obj) [0];
}
Else {
Return document. createEl (obj );
}
}
No exceptions have been found in ie.