+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
Like Tree2Likes

Thread: make ads load after the page is done loading

  1. #1
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Exclamation make ads load after the page is done loading

    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!


  2. #2
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: make ads load after the page is done loading

    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.

  3. #3
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Exclamation Re: make ads load after the page is done loading

    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 is
    Code:
    <span="x10ads">
    <script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate" width="468" height="60" id="x10ads" "></script><br>
    </span>
    and the ending code is
    Code:
    <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>
    thanks once again
    Check Out My Site http://www.playminigames.co.cc
    not very far comments?PM Me

    New Promising PTC site!


  4. #4
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: make ads load after the page is done loading

    change this
    HTML Code:
    <span="x10ads">
    <script type="text/javascript" src="http://x10hosting.com/adserve.js?corporate" width="468" height="60" id="x10ads" "></script><br>
    </span>
    to
    HTML Code:
    <span="x10ads"></span>
    the second block with the javascript innerHTML() will add the contents of that string to the block that has the id `x10ads`.

  5. #5
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Re: make ads load after the page is done loading

    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?

    Code:
    <span="x10ads"></span>
    and
    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!


  6. #6
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: make ads load after the page is done loading

    Quote Originally Posted by igames View Post
    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?[/code]
    lol, i must have over looked this:

    change
    Code:
    <span="x10ads"></span>
    to
    Code:
    <span id="x10ads"></span>
    karimirt47 likes this.

  7. #7
    t2t2t's Avatar
    t2t2t is offline x10 Elder t2t2t is an unknown quantity at this point
    Join Date
    Sep 2006
    Location
    Europe, Estonia
    Posts
    690

    Re: make ads load after the page is done loading

    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:

    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>
    Also, why did you give width and height to script tag? It's not like it's gonna do something that way..
    This post has been marked spam 52 times.


  8. #8
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Re: make ads load after the page is done loading

    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!


  9. #9
    woiwky is offline x10 Lieutenant woiwky is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    390

    Re: make ads load after the page is done loading

    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:
    HTML Code:
    <script type="text/javascript" language="Javascript">
    function moveAds() {
        document.getElementById('ads').innerHTML = document.getElementById('hiddenads').innerHTML;
    }
    </script>
    The <body> tag:
    HTML Code:
    <body onload="moveAds();">
    Then where you want the ads to show up:
    HTML Code:
    <div id="ads"></div>
    And this at the bottom of the page:
    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>
    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.
    dinomirt96 likes this.
    "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"

  10. #10
    igames is offline x10Hosting Member igames is an unknown quantity at this point
    Join Date
    Sep 2008
    Posts
    34

    Exclamation Re: make ads load after the page is done loading

    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!


+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Ads make my site not load.
    By WoMBaT in forum Free Hosting
    Replies: 0
    Last Post: 08-16-2008, 11:51 AM
  2. Server Problems
    By coconut999 in forum Free Hosting
    Replies: 4
    Last Post: 07-19-2008, 12:53 PM
  3. Load Pages from one Page via URI
    By VPmase in forum Tutorials
    Replies: 1
    Last Post: 05-02-2008, 02:35 AM
  4. Problem Loading Page
    By Chaad in forum Free Hosting
    Replies: 2
    Last Post: 03-05-2008, 01:00 PM
  5. Page Wont Load now ?
    By scheols in forum Free Hosting
    Replies: 2
    Last Post: 07-30-2006, 09:22 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers