// So, given a syndication script with a fixed ID: <script type="text/javascript" id="syndication" src="syndication.js">script> // We can go from oldskool nastiness like this: document.write('Here is some syndicated content.
'); // To modern loveliness like this: var newcontent = document.createElement('p'); newcontent.id = 'syndicated-content'; newcontent.appendChild(document.createTextNode('Here is some syndicated content.')); var scr = document.getElementById('syndication'); scr.parentNode.insertBefore(newcontent, scr); // We could even go a step further and remove the <script> ID, but in that case we would need a concrete method for identifying the specific element. We could do that by knowing its SRC: var scripts = document.getElementsByTagName('script'); for(var i=0; i<scripts.length; i++) { if(scripts[i].src == 'http://www.mydomain.com/syndication.js') { //scripts[i] is the one break; } }