使用可能包含document.write的src動態(tài)添加腳本標(biāo)記我想動態(tài)地在網(wǎng)頁中包含一個腳本標(biāo)簽但是我無法控制它的src所以src =“source.js”可能看起來像這樣。document.write('<script type="text/javascript">')document.write('alert("hello world")')document.write('</script>')document.write('<p>goodbye world</p>')現(xiàn)在通常放<script type="text/javascript" src="source.js"></script>在頭部工作正常但是有沒有其他方法我可以使用像innerHTML這樣的東西動態(tài)添加source.js?我嘗試過的東西
使用可能包含document.write的src動態(tài)添加腳本標(biāo)記
眼眸繁星
2019-08-12 15:57:36