Home  >  Article  >  Web Front-end  >  JavaScript在IE中“意外地调用了方法或属性访问”_javascript技巧

JavaScript在IE中“意外地调用了方法或属性访问”_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:58:301213browse

同样一段代码,两次调用,一次通过,一次异常:
function clearSelect(obj){
if(obj && obj.options)
obj.options.length=0;
}
以下是前人的一些经验:
这是两个经典异常,不知道原理的话很难定位。从下面的代码中可用看到发生的条件




p标签的innerHtml不能插入center标记:


下面这个是经典的“无法打开Internet站点”异常:

从这些例子可以看到IE的健壮性还是有挺大的提升余地的。
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn