Handling two javascripts in IE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xiks
    New Member
    • Feb 2008
    • 6

    Handling two javascripts in IE

    Hi,

    I have a Flash menu (Flash MX) and it has links that will open in a <div> in my html document, through a javascript function.

    Flash code relating to the javascript:
    getURL("javascr ipt:loadLeft('e squerda', '" + subleft[__reg3][__reg2] + "','400','179') " );
    getURL("javascr ipt:loadPage('c onteudo', '" + subLink[__reg3][__reg2] + "','400','721') " );

    Javascript in the HTML document:

    [CODE=javascript]<script language="JavaS cript">

    function loadLeft(id,url ,varheight,varw idth) {

    // create iframe inside content div
    document.getEle mentById(id).in nerHTML = "<iframe name='IFrameLef t' frameborder='no ' scrolling='no' width='" + varwidth +"' height='" + varheight + "'></iframe>";

    // set the iFrame's height
    document.all.IF rameLeft.height = varheight;

    // insert content of HTML file into created iframe
    document.all.IF rameLeft.src = url;
    }

    </script>

    <script language="JavaS cript">

    function loadPage(id,url ,varheight,varw idth) {

    // create iframe inside content div
    document.getEle mentById(id).in nerHTML = "<iframe name='IFrameCon tent' frameborder='no ' scrolling='no' width='" + varwidth +"' height='" + varheight + "'></iframe>";

    // set the iFrame's height
    document.all.IF rameContent.hei ght = varheight;

    // insert content of HTML file into created iframe
    document.all.IF rameContent.src = url;
    }


    </script>
    [/CODE]
    This is what happens, basically, or what I want to happen:
    There's two <div>, one named "esquerda" and the other named "conteudo", and each link in flash orders the to open a different ifram on each. This is to avoid a framed site, that in this case doesn't make the trick. This works beautifully in Firefox, but not in IE, where it only opens one of the iframes.

    The question is: wha'ts wrong with the code that makes IE not to handle it well?

    Thanks in advance!
    Last edited by gits; Feb 18 '08, 03:56 PM. Reason: added code tags
  • xiks
    New Member
    • Feb 2008
    • 6

    #2
    Here you can see it working:
    http://www.dreamfeel.p t/index_relativo. html

    Comment

    • gits
      Recognized Expert Moderator Expert
      • May 2007
      • 5388

      #3
      what to do on the page to see the error? IE shows some errors right after the page is loaded ... i assume from here:

      Code:
      onLoad = "MM_preloadImages('imgs/gerais/bot_es-ovr.gif','imgs/gerais/bot_fr-ovr.gif')"
      where is that code included?

      kind regards

      Comment

      • xiks
        New Member
        • Feb 2008
        • 6

        #4
        Hello,

        That problem is solved, now. It was related with 2 rollover images. However, the main problem is still there.

        Comment

        • xiks
          New Member
          • Feb 2008
          • 6

          #5
          There are 2 of the buttons on the flash menu that are working for now, for testing.
          They are, rolling over the 'DreamWeb' area and in it's submenu, the items that are working (at least in Firefox!) are the two first links on the left.

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            Firebug in Firefox still states: MM_preloadImage s is not defined ... so fix that first. the dropdown tries to use the window.onload event but the document itself uses it already with the dreamweaver-code ... use an init-function and combine the calls in case you need them all. i assume the leftFrame-loading is not working in IE? so try to alert the params and the innerHTML from the related function ... what do you get alerted?

            kind regards

            Comment

            • xiks
              New Member
              • Feb 2008
              • 6

              #7
              Hi again,

              I didn't even know about the error console in Firefox... duh! Tha'ts great. Well, I've solved the load images error and, when we click one of the two working links in flash we get some "Non-standadard with W3c" errors, but I don't know how to make them w3c compliant because I know nothing about Javascript... It might be that what's causing the problem in IE.....?

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5388

                #8
                you could/should use for example:

                [CODE=javascript]document.getEle mentById('your_ id').src = 'your_src';[/CODE]
                instead of document.all best way would be:

                [CODE=javascript]// store a reference to the node (element) with id = 'your_id'
                var node = document.getEle mentById('your_ id');

                // now you may set some attributes and/or properties with:
                node.setAttribu te('attr_name', 'attr_value');
                node.property_n ame = 'property_value ';
                [/CODE]
                kind regards

                Comment

                • xiks
                  New Member
                  • Feb 2008
                  • 6

                  #9
                  Thank you.
                  I'll get someone here who know something about programming sintax to try that.

                  I'll tell you what happened then.

                  Comment

                  Working...