asp.net mvc - MicrosoftMvcAjax.js throws javascript error when updating table elements in IE8 [closed]
In IE8 or anything older, innerHTML is not supported on certain elements like TR & TD. Unfor开发者_Go百科tunately, the MicrosoftMvcAjax.js file included in the MVC 2 project uses innerHTML for the Ajax update method within the Ajax.BeginForm or Ajax.ActionLink.
To fix that, look into Line 18 of MicrosoftMvcAjax.js and replaced it with this:
Sys.Mvc.MvcHelpers.updateDomElement=function(target,insertionMode,content){if(target){switch(insertionMode){case 0:$(target).html(content);break;case 1:if(content&&content.length>0){$(target).html(content+target.innerHTML.trimStart());}break;case 2:if(content&&content.length>0){$(target).html(target.innerHTML.trimEnd()+content);}break;}}}
Basically, I took out the innerHTML call and replaced it with jQuery's html().
精彩评论