when I add the script tag in body tag of my index.html directly, like below:
<script type="text/javascript" src='**doc_write_in_it.js**'></script>
It works well, the "test doc write" is output there.
But if I write in another way, like below:
<script type="text/javascript">
var model = document.createElement('script');
model.setAttribute('type','text/javascript');
model.setAttribute('src','doc_write_in_it.js');
var bd = document.getElementsByTagName('body')[0];
bd.appendChild(model);
</script>
document.write become invalid within Javascript file which is added by appendChild.
The alert in doc_write_in_it.js will show, but the text in document.write doesn't.
doc_write_in_it.js file is like this:
alert('activited');
document.write('test doc write");
Hope someone can help... Thanks a lot...