[Urgent] OMG!! This is hitting my head!! Please help!!!

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by lair360, Feb 14, 2009.

  1. lair360

    lair360 New Member

    Messages:
    200
    Likes Received:
    0
    Trophy Points:
    0
    Hi everyone! I am creating this script and its driving me crazy!!!!
    I don't know if this JavaScript will load all of my JScript first and let the page load second....

    Could you please check if its correct?????

    Thank you!

    ----------------------------
    Code:
    <script  language="Javascript" type="text/javascript">
    <!-- hide from non JavaScript Browsers
    
    if (!window.addScript)
    {
        window.addScript = function (src, callback) {
            var head = document.getElementsByTagName("head")[0];
            var script = document.createElement("script");
            script.src = src;
            script.type = "text/javascript";
            head.appendChild(script);
            if (typeof callback == "function") callback();
        };
    }
    
    window.addOnLoad(function () {
        window.addScript("image_preload.js");
        window.addScript("http://pub.oxado.com/insert_ad?pub=220440");
        }
    );
    // -->
    </script>
    Please look and see if its correct....

    Also, for those who correct any mistake will recieve 200 points!
    The winner will be allowed to use this code for their website!
     
  2. xav0989

    xav0989 Community Public Relation Community Support

    Messages:
    4,467
    Likes Received:
    95
    Trophy Points:
    0
    The best and simplest way to include the JS that you want is to directly include it:
    Code:
    <script  language="Javascript" type="text/javascript" src="image_preload.js"></script>
    <script  language="Javascript" type="text/javascript" src="http://pub.oxado.com/insert_ad?pub=220440"></script>
    
     
  3. lair360

    lair360 New Member

    Messages:
    200
    Likes Received:
    0
    Trophy Points:
    0
    I would like to use my type so that it could cache the JScript faster (dynamically).
     
  4. xav0989

    xav0989 Community Public Relation Community Support

    Messages:
    4,467
    Likes Received:
    95
    Trophy Points:
    0
    Well I don't seem to see any problem with your script. Could you give me an url...
     
  5. lair360

    lair360 New Member

    Messages:
    200
    Likes Received:
    0
    Trophy Points:
    0
    I've inserted it into my hompage, please click clear your internet caches first and click on my Signature....

    Tell me how fast it loads...
    Edit:
    Is this part correct???

    Code:
    window.addOnLoad(function () {
        window.addScript("image_preload.js");
        window.addScript("http://pub.oxado.com/insert_ad?pub=220440");
        }
    );
    // -->
    </script>
     
    Last edited: Feb 14, 2009

Share This Page