动态平添js到html页面,并传递参数的代码
动态添加js到html页面,并传递参数的代码
看淘宝的页面 ,摘录下来
<script type="text/javascript"> (function (d) { var ta=d.createElement("script");ta.type="text/javascript";ta.async=true;ta.id="tb-beacon-ac"; ta.setAttribute("exparams","category=item_50000557&userid=&channel=112&at_isb=0&at_isb=0&at_autype=5_35552220&"); ta.src=("https:"==d.location.protocol?"https://s":"http://a")+".tbcdn.cn/s/ac.js"; d.getElementsByTagName("head")[0].appendChild(ta); })(document); </script>
看淘宝的页面 ,摘录下来