【问题标题】:Using table inside dijit.form.ContentPane doesn't work in Internet Explorer 7在 dijit.form.ContentPane 中使用表在 Internet Explorer 7 中不起作用
【发布时间】:2009-11-12 22:19:17
【问题描述】:

我在使用 ContentPane 中的表格时遇到问题。它似乎在 Firefox 中运行良好,但在 Internet Explorer 7 中不可见。下面的 html 说明了我的意思。在 Firefox 中你会得到:

餐桌前
这是桌子
桌后

在 Internet Explorer 7 中,您可以获得:

餐桌前
桌后

根本没有桌子。有谁知道这个问题的原因吗?

<html>
<head>
<link rel="stylesheet" type="text/css" href="http://o.aolcdn.com/dojo/1.3.2/dojo/resources/dojo.css" />
<link rel="stylesheet" type="text/css" href="http://o.aolcdn.com/dojo/1.3.2/dijit/themes/tundra/tundra.css" />
<script djConfig="parseOnLoad:true" type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.2/dojo/dojo.xd.js">
</script>
<script type="text/javascript">
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.form.Form");
dojo.addOnLoad(initialize);
function initialize() {
    var contentPane = new dijit.layout.ContentPane({});
 contentPane.domNode.appendChild(document.createTextNode("Before Table"));
 var table = document.createElement("table");
 var tr = document.createElement("tr");
 var td = document.createElement("td");
 td.appendChild(document.createTextNode("This is the table"));
 tr.appendChild(td);
 table.appendChild(tr);
 contentPane.domNode.appendChild(table);
 contentPane.domNode.appendChild(document.createTextNode("After Table"));
 dojo.place(contentPane.domNode, dojo.body(), "first");
}
</script>
</head>
<body class="tundra"></body>
</html>

【问题讨论】:

    标签: dojo internet-explorer-7 dijit.layout


    【解决方案1】:

    我发现了问题。以编程方式创建表时,您需要确保在表节点内放置一个 tbody 节点(以及其中的 tr 节点)。以下作品:

    <html>
    <head>
    <link rel="stylesheet" type="text/css" href="http://o.aolcdn.com/dojo/1.3.2/dojo/resources/dojo.css" />
    <link rel="stylesheet" type="text/css" href="http://o.aolcdn.com/dojo/1.3.2/dijit/themes/tundra/tundra.css" />
    <script djConfig="parseOnLoad:true" type="text/javascript" src="http://o.aolcdn.com/dojo/1.3.2/dojo/dojo.xd.js">
    </script>
    <script type="text/javascript">
    dojo.require("dijit.layout.ContentPane");
    dojo.addOnLoad(initialize);
    function initialize() {
        var contentPane = new dijit.layout.ContentPane({});
        contentPane.domNode.appendChild(document.createTextNode("Before Table"));
        var table = document.createElement("table");
        var tbody = document.createElement("tbody");
        var tr = document.createElement("tr");
        var td = document.createElement("td");
        td.appendChild(document.createTextNode("This is the table"));
        tr.appendChild(td);
        tbody.appendChild(tr);
        table.appendChild(tbody);
        contentPane.domNode.appendChild(table);
        contentPane.domNode.appendChild(document.createTextNode("After Table"));
        dojo.place(contentPane.domNode, dojo.body(), "first");
    }
    </script>
    </head>
    <body class="tundra"></body>
    </html>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-07
      • 1970-01-01
      • 2011-12-07
      • 2011-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多