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里就可以了!

  • 相关阅读:
    关于求LCA三种方法
    逆序对与本质不同的逆序对
    缩点+割点(tarjan)
    关于线段树
    引爆点
    0 基础认知产品经理
    一款 App 开发到上架
    坚持+时间管理
    测试流程
    Java学习笔记--字符串String、StringBuffer和StringBuilder
  • 原文地址:https://www.cnblogs.com/cnlove/p/3034972.html
Copyright © 2011-2022 走看看