Home > Web Front-end > JS Tutorial > body text

解决ExtJS在chrome或火狐中正常显示在ie中不显示的浏览器兼容问题_extjs

WBOY
Release: 2016-05-16 17:43:53
Original
1334 people have browsed it

用ExtJS开发将近一年了,也遇到了很多奇怪的问题,印象最深的要算是ExtJS在ie中显示的问题了。由于开发过程中大多用chrome来调试,很少在ie中调试(现在两者都要兼顾),导致最后在ie中页面不能正常加载,当时那个囧啊,看到ie报的错,我都想哭,连出错的堆栈信息都没有(这一点,ie做的真不好),无从下手啊。尝试过N多方法,最后发现导致出现这种问题的原因(90%以上的可能性)是js的数组中多了一个英文的逗号',',而这种在chrome和火狐中是没有问题的,如下面的代码所示:

复制代码 代码如下:

var win = Ext.create('Ext.window.Window',{
//此处省略若干代码
//........
items:[
{
title:'hello',
width:100,
height:100
},{
title:'world',
width:100,
height:100
},{
title:'foo',
width:100,
height:100
},//注意这里的英文逗号,在chrome和火狐中不会报错
]
//此处省略若干代码
//........
})

这是浏览器对数组处理的一个差异。大家写代码的时候要注意一下,如果有类似的问题可以试着找找看,也许就能够解决了,我遇见过三次,都是这个问题。(完)^_^
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!