hey i was searching online and couldn't get a correct code for making ads load last with javascript, so i hope you can tell me how to do it and the code for it. i would be very grateful if you could give me a solution. thanks!
hey i was searching online and couldn't get a correct code for making ads load last with javascript, so i hope you can tell me how to do it and the code for it. i would be very grateful if you could give me a solution. thanks!
Check Out My Site http://www.playminigames.co.cc
not very far comments?PM Me
New Promising PTC site!
check out one of my tutorials in my sig
EDIT >>
http://forums.x10hosting.com/tutoria...-using-js.html
+REP if it helped
Last edited by diabolo; 01-22-2009 at 08:33 PM.
im sorry if im making this more difficult than it really is but im not getting the result. ok so my code for where the ad should be placed isand the ending code isCode:<span="x10ads"> <script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate" width="468" height="60" id="x10ads" "></script><br> </span>thanks once againCode:<script language="javascript"> document.getElementById("x10ads").innerHTML = "<script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate" width="468" height="60" id="x10ads" "></script>"; </script>
Check Out My Site http://www.playminigames.co.cc
not very far comments?PM Me
New Promising PTC site!
change thistoHTML Code:<span="x10ads"> <script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate" width="468" height="60" id="x10ads" "></script><br> </span>the second block with the javascript innerHTML() will add the contents of that string to the block that has the id `x10ads`.HTML Code:<span="x10ads"></span>
hmmmm im still not getting the result. i am not getting any ad to load so here is the code is anything wrong with it?
andCode:<span="x10ads"></span>
Code:<script language="javascript"> document.getElementById("x10ads").innerHTML = " <script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate" width="468" height="60" ">"; </script>
Check Out My Site http://www.playminigames.co.cc
not very far comments?PM Me
New Promising PTC site!
Here's a thing I lately found out: Javascript won't execute if just entered into .innerHTML (at least for modern browsers). Here's a work around:
Also, why did you give width and height to script tag? It's not like it's gonna do something that way..HTML Code:<div id="x10ads"></div> <!-- Feel free to change the tag --> <!-- Then at bottom of page: --> <script type="text/javascript"> var scriptEl = document.createElement('script') scriptEl.type = 'text/javascript' scriptEl.src = 'http://x10hosting.com/adserve.js?corporate' document.getElementById('x10ads').appendChild(scriptEl) </script>
umm im having a problem, when everything is done loading the ad loads in the rest of the page dissapears soi just want it to load where the div tags are. thanks
Check Out My Site http://www.playminigames.co.cc
not very far comments?PM Me
New Promising PTC site!
If you're gonna be doing it in this pseudo-onload way(with the ads being at the bottom of the page, rather than having them created with the onload event), then you could try placing them in an invisible div at the bottom and use the onload event to just move them. Something like:
In the <head> tag:
The <body> tag:HTML Code:<script type="text/javascript" language="Javascript"> function moveAds() { document.getElementById('ads').innerHTML = document.getElementById('hiddenads').innerHTML; } </script>
Then where you want the ads to show up:HTML Code:<body onload="moveAds();">
And this at the bottom of the page:HTML Code:<div id="ads"></div>
I'm not 100% sure this will work without any problem. Personally, I would generate the ads in the onload event so as to be sure the content is fully loaded first. This would be harder to do, though.HTML Code:<div id="hiddenads" style="display: none;"> <script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate" width="468" height="60" id="x10ads"></script> </div>
"But you have access to the greatest source of knowledge in the universe."
"Well I do talk to myself sometimes, yes."
"I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"
ok woiwky your code worked the best but i cant get it to diplay in the header, i dont know whats happening its allways diplaying it after the header, i tried moving it but there wasnt anything there to display it. thanks
Check Out My Site http://www.playminigames.co.cc
not very far comments?PM Me
New Promising PTC site!