Add javascript variable to javascript src?

后端 未结 5 764
暗喜
暗喜 2021-01-19 19:38

this may sound a bit noobish, but I\'m trying to retrieve the video information for a YouTube video (I saw in some tutorial) basically here\'s the code

             


        
5条回答
  •  臣服心动
    2021-01-19 20:04

    Either document.write it or createElement()/appendChild()

    var id = "asdf";
    document.write('\x3Cscript type="text/javascript" src="foo.js?id=' + id + '">\x3C/script>');
    

提交回复
热议问题