动态脚本,在js里面又写js

不知道怎么回事

代码测试不过

            var a=document.createElement("script");
            a.type="text/javascript";
            a.appendChild(document.createTextNode("function hello(){console.log('hello world');}"));
            document.body.appendChild(a);

 

posted on 2016-09-12 22:40  Kooing  阅读(190)  评论(0编辑  收藏  举报

导航