4 Replies Latest reply on Oct 19, 2011 10:00 AM by uandme72

    Accessing parent document variables and div tags from child documents

    uandme72 Level 1

      I am loading an ASP document (Child)inside another ASP document (Parent) using Include statements.

      The parent document has certain div tags which have some properties to be accessed from inside the code in child document using javascript.

      Please advise on how to access the parent document varioables and div tags from inside the child document which has been loaded from within the parent document.

        • 1. Re: Accessing parent document variables and div tags from child documents
          MurraySummers Level 8

          It would really not be possible to advise you without seeing your code.  Can you show us this div tag and tell us what it is you want to access?

          • 2. Re: Accessing parent document variables and div tags from child documents
            uandme72 Level 1

            <script src="/SpryAssets/SpryHTMLPanel.js" language="javascript" type="text/javascript"></script>
            <script src="/SpryAssets/SpryTabbedPanels.js" language="javascript" type="text/javascript"></script>
            <link href="/SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
            <link href="/SpryAssets/SpryHTMLPanel.css" rel="stylesheet" type="text/css" />
            <script language="javascript">
            Spry.Widget.HTMLPanel.evalScripts = true;

            </script>
            </head>

            <body>
            <div class="TabbedPanels" id="TabbedPanels2">
            <ul class="TabbedPanelsTabGroup">
            <li class="TabbedPanelsTab" tabindex="0" >Tab 1</li>
            <li class="TabbedPanelsTab" tabindex="0" onclick="tab2.loadContent('test1/load.asp');return false;">Tab 2</li>
            </ul>
            <div class="TabbedPanelsContentGroup">
            <div class="TabbedPanelsContent" id="tab1">test content 1</div>
            <div class="TabbedPanelsContent" id="tab2">test content 2</div>
            </div>
            </div>


            <script type="text/javascript">
            var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels2");

            var tab1 = new Spry.Widget.HTMLPanel("tab1");

            var tab2 = new Spry.Widget.HTMLPanel("tab2");
            </script>

            • 3. Re: Accessing parent document variables and div tags from child documents
              MurraySummers Level 8

              What are you wanting to do with this code?

              • 4. Re: Accessing parent document variables and div tags from child documents
                uandme72 Level 1

                This is the code from the parent document containing tabbed panels, which loads the child document 'load.asp' as indicated in the above script in one of the tabbed panels.

                The child document 'load.asp' itself contains ajax script to load the child page without reloading the whole page. It works perfectly fine if the child document is loaded outside the tabbed panels.

                However, if the parent document is loaded and the child page gets loaded alongwith it, the ajax script does not work as desired. The ajax script loads the child document outside the tabbed panels and it also displaces the original parent document from the browser itself.

                This is not what is required. What we require is that the child document continues to load inside the parent document's tabbed panels even after their javascript/ ajax script is called from the parent document loading it as indicated above.

                Please advise.