To much javascript on one page

Discussion in 'JavaScript' started by scriptsy26, Aug 6, 2010.

  1. #1
    Hello,

    I post it here in de javascript section but my script is in php so i do not know if i am right here, but a widget is not loading because too much javascripts are interfering with eachother.

    How can i make this better? so that the widget is loading.

    Thanks

    greetings
     
    scriptsy26, Aug 6, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    This doesn't really tell us anything, you need to provide more information such as what widget this is, the js source, etc. Just how do you even know it's interfering with each other? =/ If it does, try to remove either and see.
     
    Rainulf, Aug 6, 2010 IP
  3. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    More then likely it is to do with having multiple window.onload events when there can only be one. You need to find the part of the code that handles this for each script and combine them into one onload event.
    e.g:
    
    //script 1
    window.onload = script1init;
    
    //script 2
    window.onload = script2init;
    
    Code (markup):
    change to
    
    window.onload = function() {
        script1init();
        script2init();
    }
    
    Code (markup):
     
    camjohnson95, Aug 6, 2010 IP
  4. scriptsy26

    scriptsy26 Active Member

    Messages:
    274
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    83
    #4
    Oke this is also very helpfull, good tips and i will take look if this is the problem. Thanks for your help.




     
    scriptsy26, Aug 7, 2010 IP