2

我想通过 yui3 注入 iframe 头。示例代码在 FF 中工作,但 IE9 显示错误“YUI 未定义”。我不知道IE9会发生什么。

<head>
    <script src="http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js"></script>
    <script src="./test-yui.js"></script>
</head>
<body>
    <iframe src="#" id="frame"></iframe>
</body>
    var SC = 'script';
    YUI().use('node', function (Y) {
        var frame = Y.Node.getDOMNode(Y.one('#frame'));
        o = frame.contentWindow.document;
        o.open().write(
            '<head><' + SC + ' type="text/javascript" src="http://yui.yahooapis.com/3.5.0/build``/yui/yui-min.js"></' + SC + '>'+
            '<' + SC + '>YUI().use(\'tabview\', \'node\', function(Y) {});</' + SC + '>'+
            '</head>'+
            '<body><div class="unit_title" >HELLO WORLD</div></body>');
        o.close();
    });
4

1 回答 1

0

尝试写入 iframe 可能会很棘手我建议查看 YUI 中的Frame模块,有关使用它的一些详细信息可以在此处找到http://www.andrewwooldridge.com/blog/2011/04/14/hidden-yui-gem -框架/

于 2012-12-14T01:04:12.550 回答