1 Reply Latest reply on Jun 1, 2013 10:47 AM by GuyOX4

    getElementById from parent works for Firefox not  for IE

    GuyOX4 Level 2

      I am trying to access an element in my Edge Animate animation (which is a menu bar) from the parent document.  The element has an onClick event which is triggered depending on the #bookmark in the URL of the parent web page.  My code works perfectly in Firefox but does not work in Internet Explorer(10).  IE is unable to see any elements within the 'Stage' div whereas Firefox can.


      This is the JavaScript code on my parent page: -


      <script language='javascript'>

            var thisPage = window.location.pathname;

            var fullurl = document.URL;

            var xxx = fullurl.substring(fullurl.indexOf('#'));

            var pageString = xxx.replace("#", "");

            pageString = pageString.replace("http://www.mydomain.com/portfolio/photography.html", "");

            if (pageString == "corporate") {

                  window.onload = function()  { 

                  var iframe = document.getElementById('U10511_animation');

                  var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;

                  var corporateRectangle = innerDoc.getElementById('Stage_Corporate_Rectangle');








      The above code will select the Corporate tab in the menu when viewed in Firefox but not IE when the URL has the suffix #corporate.


      When I insert an 'alert' for the variable 'corporateRectangle' in Firefox it returns [HTMLObj] and in IE it returns 'null'.


      Any ideas anyone?  Thanks.

        • 1. Re: getElementById from parent works for Firefox not  for IE
          GuyOX4 Level 2

          The issue was that the menu animation has a preloader.  Firefox ignores the preloader whereas IE treats the preloader as onLoad being complete.  Therefore the attempt to access the element ID is null as it hasn't been loaded yet.


          I decided to approach the problem from a different tack and read my bookmark from within the animation.  This turned out to be a very simple solution once I figured out that I had to put the code in the first frame of the animation NOT in creationComplete or compositionReady.

          This was the code: -

              var bookmark = parent.window.location.hash;
              bookmark = bookmark.replace("#", "");
              if (bookmark == "corporate") {




          yes, as simple as that.