extjs和Internet Explorer 8的问题

Man*_*uro 2 javascript internet-explorer extjs


我用extjs库编写了一个程序,该程序在所有浏览器中工作正常,除了Internet Explorer 8,问题是,当我从localhost加载它时,它工作,但是当从服务器访问时,它不加载页面,我有一个空白页面,
我删除了一个逗号,程序从服务器访问时开始工作.有人有解释吗?

这是标题:

 <!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" xml:lang="en" lang="en">
<head>
    <meta name="Description" content="Default Style" />
    <meta name="Version" content="2.1.1" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <title>project name</title>
    <link rel="stylesheet" type="text/css" href="./style/default/main.css" media="all" />
    <style type="text/css" media="all">@import "./style/default/main.css";</style>
    <link rel="shortcut icon" href="./style/default/images/favicon.ico" type="image/ico" />
    <script type="text/javascript" src="http://10.215.63.218/Apsys/js/base.js"></script>
<script type="text/javascript" src="http://10.215.63.218/app/js/collapse.js"></script>
<script type="text/javascript" src="http://10.215.63.218/app/lib/overlib/overlib.js"></script>
</head>
Run Code Online (Sandbox Code Playgroud)

Sea*_*son 12

Internet Explorer无法处理对象和数组上的尾随逗号.这成为Ext的一个特别反复出现的问题,你经常创建大对象,每行一个属性,以及评论/删除很多东西.

这将在IE中打破:

new Ext.Panel({
    id: 'mypanel',
    cls: 'my-panel-class',
    html: 'Some HTML',
    colors: [
        'yellow',
        'blue',
        'red',
        //'pink'
    ],
    renderTo: Ext.getBody(),
});
Run Code Online (Sandbox Code Playgroud)

注意第一个块之后'red'和之后的额外逗号Ext.getBody().

这将有效:

new Ext.Panel({
    id: 'mypanel',
    cls: 'my-panel-class',
    html: 'Some HTML',
    colors: [
        'yellow',
        'blue',
        'red'
        //'pink'
    ],
    myArray: ['yellow', 'blue', 'red'],
    renderTo: Ext.getBody()
});
Run Code Online (Sandbox Code Playgroud)