Forum Moderators: open
<script type="text/javascript">
var object = document.createElement('div');
object.innerHTML = 'The banner script is HERE';
var body = document.getElementsByTagName('body')[0];
body.insertBefore(object, body.firstChild);
</script> The problem with this cod is that is shows in forum phpbb3 in the login page and after is loged in, twice in the header.
Demo problem: <snipped url>
Just so you know, I need to add html script banner and the JS will be placed right before </html> and AFTER </body>.
Can someone help me here ?
Kind Regards.
[edited by: whoisgregg at 1:23 pm (utc) on Aug. 18, 2009]
[edit reason] Whoops, no URLs please. See TOS [webmasterworld.com] :) [/edit]
Since you're using phpBB, perhaps there is some problem with how that application is adding the code? Perhaps there's a different template that it should be added to?
I can't check the html/template files because this files belong to my users on my free hosting.
The ad server is working corectly, I just need to know how should I fix this.
Somebody told me to try this, but the cod is only for text ads.
<script type="text/javascript">
// <![CDATA[
window.onload = function() {
if ( document.createElement ) {
var body = document.getElementsByTagName("body")[ 0 ];
var fChild = body.getElementsByTagName("*")[ 0 ];
var obj = document.createElement("div");
obj.appendChild( document.createTextNode("The banner script is here."));
body.insertBefore( obj, fChild );
return;
} alert("unsupported features, please upgrade your browser");
return false;
}
// ]]>
</script> That said, if that second code snippet works for you otherwise, it's easy to put html in the created <div>, just change this line:
obj.appendChild( document.createTextNode("The banner script is here."));
obj.innerHTML = 'html can go here';