dom - Extjs dom 和 Ext.Element 创建问题

标签 dom extjs

我使用 Ext.element 创建元素,如下所示:

var table = new Ext.Element(document.createElement('table'));

    for(n=0;n<5;n++)
    {
        row = new Ext.Element(document.createElement('tr'));
        for(x=0;x<4;x++)
        {
            col = new Ext.Element(document.createElement('td'));
            col.update('cell text '+x);    
            row.appendChild(col);
        }
        table.appendChild(row);
    }

    Ext.fly('data').replaceWith(table);

这在 FF 中有效,但在 IE 中无效,这是为什么?

最佳答案

以下代码在 IE8 中使用 ExtJS 3.3

var table = new Ext.Element(document.createElement('table'));

for(n=0;n<5;n++)
{
    var row = new Ext.Element(document.createElement('tr'));
    for(x=0;x<4;x++)
    {
        var col = new Ext.Element(document.createElement('td'));
        col.update('cell text '+x);    
        row.appendChild(col);
    }
    table.appendChild(row);
}

Ext.fly('data').replaceWith(table);

关于dom - Extjs dom 和 Ext.Element 创建问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5911896/

相关文章:

javascript - JS DOM : Get elements by text content

javascript - innerHTML 不填充父级

javascript - 使用 YUI 事件监听器在 Jquery 中移动 DOM 元素?

javascript - 通过 JS 添加新元素到现有的 Iframe

对 hasMan 关系存储中的数据进行排序 Sencha Touch/ExtJS

javascript - 如何用 Siesta 覆盖 testClass 方法?

javascript - 为什么这在 jQuery 中有效?

javascript - Ext.ModelManager.getModel 已在 extjs 5 中弃用

javascript - Sencha Touch 中的 id 和 itemID 有什么区别?

extjs - 将值绑定(bind)到面板标题