ActionScript添加动态添加JS
function () { var oIframe = document.createElement("iframe"); var id = "HelloWorld"; oIframe.setAttribute("id", id); oIframe.setAttribute("style", "width: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里就可以了!