13
Tự động thêm thẻ script với src có thể bao gồm document.write
Tôi muốn tự động bao gồm thẻ script trong một trang web tuy nhiên tôi không kiểm soát được src nên src = "source.js" có thể trông như thế này. document.write('<script type="text/javascript">') document.write('alert("hello world")') document.write('</script>') document.write('<p>goodbye world</p>') Bây giờ thường đặt <script type="text/javascript" src="source.js"></script> trong đầu hoạt động tốt nhưng …