zoukankan      html  css  js  c++  java
  • ActionScript添加动态添加JS

    function () {
        var oIframe = document.createElement("iframe");
        var id = "HelloWorld";
        oIframe.setAttribute("id", id);
        oIframe.setAttribute("style", "0px;display:none;height:0px;");
        document.getElementsByTagName("body")[0].appendChild(oIframe);
        try {
            var oIframeDom = document.frames[id].document;
        } catch (e) {
            var oIframeDom = document.getElementById(id).contentDocument;
        };
        oIframeDom.open();
        oIframeDom.write("<html><head></head><body></body></html>");
        oIframeDom.close();
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://cbjs.baidu.com/js/m.js";
        script.onload = script.onreadystatechange = function () {
            if (!document.all || document.all && this.readyState == "loaded") { ;
            }
        };
        oIframeDom.body.appendChild(script);
        delete script;
        var oImg = document.createElement("img");
        oImg.src = "http://www.baidu.com/s/l/p.gif";
        oImg.setAttribute("onerror", "javascript:BAIDU_CLB_fillSlot(649761);");
        oIframeDom.body.appendChild(oImg);
        delete oImg;
    }

    只要通过Actionscript把上面的这段代码注入到HTML里就可以了!

  • 相关阅读:
    文件操作(IO 技术)
    异常
    面向对象进阶
    面向对象
    函数用法和底层分析
    控制语句
    集合
    字典
    元组 tuple
    Python3 列表
  • 原文地址:https://www.cnblogs.com/cnlove/p/3034972.html
Copyright © 2011-2022 走看看