IE8中的createElement错误

时间:2011-08-05 13:41:35

标签: javascript internet-explorer-8 createelement

我在IE8中的以下行收到跟随错误(不是在IE9或chrome或firefox中)

popup = document.createElement('div');

错误:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Timestamp: Fri, 5 Aug 2011 13:39:41 UTC


Message: Object doesn't support this property or method
Line: 72
Char: 5
Code: 0
URI: http://192.168.7.1/fquick/script.js

我该如何解决?

1 个答案:

答案 0 :(得分:2)

将行更改为

var popup = document.createElement('div');

它有效。有趣。