I want to dynamically add a javascript tag, whose src points to an external source, whose result will generate some other javascript. That javascript will draw external data, a table for football teams.
If I include it with document.write it works fine.
<script type="text/javascript">
var everysport_u="http://puff.everysport.com/team_puff_competitiontable_normal_script_52764:0.html";
document.write("<scr"+"ipt type='text/javascript' charset='ISO-8859-1' src='"+everysport_u);
var everysport_r=Math.floor(Math.random()*99999999999);
document.write("?_r="+everysport_r);
document.write("'><\/scr"+"ipt>");
</script>
Howevery using DOM manipulation it does not.
var script = document.createElement('script');
var everysport_r=Math.floor(Math.random()*99999999999);
var everysport_u = "http://puff.everysport.com/team_puff_competitiontable_normal_script_52764:0.html";
script.src = everysport_u;
script.type = 'text/javascript';
document.getElementById('everysport-accordion').appendChild(script);
#everysport-accordionexist at the time of script execution?