Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

including a file stops function from runing?? why

  • 08-07-2008 11:03pm
    #1
    Registered Users, Registered Users 2 Posts: 483 ✭✭


    lo,
    csn any one see why including this function on to a web page:
    <script type="text/javascript">
    <!--//--><![CDATA[//><!--
    startList = function() {
        if (document.all&&document.getElementById) {
            navRoot = document.getElementById("nav");
            for (i=0; i<navRoot.childNodes.length; i++) {
                node = navRoot.childNodes[i];
                if (node.nodeName=="LI") {
                    node.onmouseover=function() {
                        this.className+=" over";
                    }
                    node.onmouseout=function() {
                        this.className=this.className.replace(" over", "");
                    }
                }
            }
        }
    }
    window.onload=startList;
    //--><!]]>
    </script>
    
    would stop this function running on the
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAsiQvuugI6Ni06Zq-4qcw8xRDySWSj47LhKkbc2n0qzQPgi3L7hS02DtDqb_nguwz4fdmwsrHj5E1vw"type="text/javascript"></script>
    <script type="text/javascript">
    function load() {
        if (GBrowserIsCompatible()) {
           var map = new GMap2(document.getElementById("map"));
           map.addControl(new GSmallMapControl());
           map.addControl(new GMapTypeControl());
           map.setCenter(new GLatLng(53.396432, -7.470703), 5);      
           GEvent.addListener(map, "click", function(overlay, point){
             map.clearOverlays();
             if (point) {
                 map.addOverlay(new GMarker(point));
                 map.panTo(point);
                 document.form1.mylat.value = point.lat();
                 document.form1.mylng.value = point.lng();
        
             }  //close if(point)...
           });   //close GEvent...
        }  //close if(GBrowser...
    } //close load()
    </script>
    
    ive been lookin for ages and my brain is fried!!

    Cheers
    Richie


Comments

  • Closed Accounts Posts: 81 ✭✭dzy


    Your best bet would be to install the Firebug extension for Firefox and step through the code in that.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    ^^ what dzy said++


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    Another +1.

    This is completely off the top of my head, but you are using:
    window.onload=startList;
    

    Is there any chance that this is overriding an onload event elsewhere?

    I think it's better practise to use:
    window.attachEvent("onload", functionname);
    


  • Registered Users, Registered Users 2 Posts: 483 ✭✭banbutcher


    eoin_s wrote: »
    Another +1.

    This is completely off the top of my head, but you are using:
    window.onload=startList;
    
    Is there any chance that this is overriding an onload event elsewhere?

    I think it's better practise to use:
    window.attachEvent("onload", functionname);
    


    Yep thats done it! i had a feeling that that might have had something to do with it alright! thanks eoin!!


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    banbutcher wrote: »
    Yep thats done it! i had a feeling that that might have had something to do with it alright! thanks eoin!!

    Wow - that was complete guesswork on my side!


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 483 ✭✭banbutcher


    good guess work tho!! :P


Advertisement