今天碰到一个问题,后台添加的一个js脚本,在ie8下会报出如下错误:
HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
奇怪的只有同事的机器有问题,我的机器没问题,搜索一番,终于解决。大概代码如下
<!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>
<body>
<form>
......
......
<script language='javascript'>alert('没有可导出的数据!');</script>
</form>
</body>
</html>
问题就出在js代码的问题,答题原因是因为脚本出现在为闭合的标签之间。
解决方法也很简单,把脚本放到</body>之后就可以了。
如果你不是开发人员,只是一个用户,遇到这个问题,就需要打一个补丁了(KB2416400),下载地址:
http://www.microsoft.com/zh-cn/download/details.aspx?id=11262,不过,这个我没有验证,不敢保证百分百有效。
参考资料: