Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: load order

  1. #1
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    load order

    is it possable to control the load order of my page, I notice that the text loads first then my java script which changes the pages organization, is it possable for the java script to load first then the text will load last, thereby you don't see the change, it's very slight but I notice it on a dial up and would really like it if I could get the java scrip to load first, it is embedied in the header, if that matters. and I don't know much about programing so dumb down your explanation, thanks

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How are you running the javascript?

    If you have it in a function and are calling it with onload then I think that could be your problem and you could try placing it within the head tags without the function (which will make it run automatically).

  • #3
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it is in the header:

    <head>
    <script type="text/javascript">

    function zapLink() {

    var allLinks = document.getElementsByTagName('a');
    for (i=0; i<allLinks.length; i++) {
    var thisLink = allLinks[i];
    if (thisLink.href.indexOf('google.com') != -1) {
    thisLink.parentNode.removeChild(thisLink);
    }
    }

    }

    window.onload = zapLink;

    </script>
    </head>
    <body>
    how do I make it run automaticley? sorry I don't know much about coding so if you can explain it really simple.

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well you could remove the function, but I'm not sure if it would help or not to be honest, you could give it a try though -

    Code:
    <head>
    <script type="text/javascript">
    var allLinks = document.getElementsByTagName('a');
    for (i=0; i<allLinks.length; i++) {
    var thisLink = allLinks[i];
    if (thisLink.href.indexOf('google.com') != -1) {
    thisLink.parentNode.removeChild(thisLink);
    }
    }
    </script>
    </head>
    Thing is, I suspect it may have to make the page load fully before it can search for the links and then remove them.

    EDIT, I found this, see if it's any use - http://scott.yang.id.au/2003/07/java...fer-attribute/ - It seems to say that onload will load last, whereas what I have done above should load first.
    Last edited by mark87; 12-07-2005 at 01:15 PM.

  • #5
    New to the CF scene
    Join Date
    Dec 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it didn't work, the script never exicuted.

    I found another page explaining this topic if you can make any since of it http://simon.incutio.com/archive/200...6/addLoadEvent

    also found this: http://www.bobbyvandersluis.com/articles/dynamicCSS.php

    I don't really know if these solutions will work or not, but it's what the pages are about so if you can take a look and tell me what you think.
    Last edited by jerblaster23; 12-07-2005 at 06:20 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •