/    Sign up×
Community /Pin to ProfileBookmark

Controlling two iframes with one link (firefox problem)

So I searched through the Internet to find a solution to this peculiar problem but although it appears that other people have similar problems the solutions offered to them did not seem to work for me. Therefore I have registered myself at webdeveloper.com in the hope of solving this problem once and for all.

I used to be a webdesigner but I have not practiced my skills lately, and now I am making an informative website for my wedding… 🙂 Designing in Illustrator and Photoshop is still in my fingers but the specific coding and the solutions to problems arising from different browser is beyond me at this point.

  • description of function –
    Using javascript to change the content of two different iframes’

  • description of problem –
    only the first (left) iframe actually changes when using Firefox. Using Google Chrome of Internet Explorer works perfectly

  • code in the head section –

  • <script>
    function twoFrameChange(left,right){
    top.left.location.href = left;
    top.right.location.href = right;
    }
    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    </script>

  • code where the iframes are –
  • <iframe name=”left” src=”danish.html” width=”410″ height=”410″ frameborder=”0″ scrolling=”no” allowtransparency=”true”></iframe>
    <iframe name=”right” src=”dutch.html” width=”410″ height=”410″ frameborder=”0″ scrolling=”no” allowtransparency=”true”></iframe>

  • code where the links are –
  • <a href=”javascript:twoFrameChange(‘dkc.html’,’ill_01.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image1′,”,’gfx/nav/ceremoni_1.gif’,1)”><img src=”gfx/nav/ceremoni_0.gif” name=”Image1″ width=”45″ height=”10″ border=”0″ align=”bottom” id=”Image1″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘dkr.html’,’ill_02.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image2′,”,’gfx/nav/reception_1.gif’,1)”><img src=”gfx/nav/reception_0.gif” name=”Image2″ width=”47″ height=”10″ border=”0″ id=”Image2″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘dkm.html’,’ill_03.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image5′,”,’gfx/nav/middag_1.gif’,1)”><img src=”gfx/nav/middag_0.gif” name=”Image5″ width=”36″ height=”10″ border=”0″ id=”Image5″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘dkoe.html’,’ill_04.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image7′,”,’gfx/nav/onsker_1.gif’,1)”><img src=”gfx/nav/onsker_0.gif” name=”Image7″ width=”36″ height=”10″ border=”0″ id=”Image7″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘dko.html’,’ill_05.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image9′,”,’gfx/nav/overnatning_1.gif’,1)”><img src=”gfx/nav/overnatning_0.gif” name=”Image9″ width=”61″ height=”10″ border=”0″ id=”Image9″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘dku.html’,’ill_06.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image11′,”,’gfx/nav/links_utrecht_1.gif’,1)”><img src=”gfx/nav/links_utrecht_0.gif” name=”Image11″ width=”41″ height=”10″ border=”0″ id=”Image11″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘dkd.html’,’ill_07.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image13′,”,’gfx/nav/deltagelse_1.gif’,1)”><img src=”gfx/nav/deltagelse_0.gif” name=”Image13″ width=”50″ height=”10″ border=”0″ id=”Image13″ /></a><img src=”gfx/nav/placeholder.gif” width=”233″ height=”10″ /><a href=”javascript:twoFrameChange(‘ill_01.html’,’nlc.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image15′,”,’gfx/nav/ceremonie_1.gif’,1)”><img src=”gfx/nav/ceremonie_0.gif” name=”Image15″ width=”49″ height=”10″ border=”0″ id=”Image15″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘ill_02.html’,’nlr.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image17′,”,’gfx/nav/receptie_1.gif’,1)”><img src=”gfx/nav/receptie_0.gif” name=”Image17″ width=”39″ height=”10″ border=”0″ id=”Image17″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘ill_03.html’,’nld.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image19′,”,’gfx/nav/diner_1.gif’,1)”><img src=”gfx/nav/diner_0.gif” name=”Image19″ width=”28″ height=”10″ border=”0″ id=”Image19″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘ill_04.html’,’nlw.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image21′,”,’gfx/nav/wensen_1.gif’,1)”><img src=”gfx/nav/wensen_0.gif” name=”Image21″ width=”38″ height=”10″ border=”0″ id=”Image21″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘ill_05.html’,’nlo.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image23′,”,’gfx/nav/overnachting_1.gif’,1)”><img src=”gfx/nav/overnachting_0.gif” name=”Image23″ width=”66″ height=”10″ border=”0″ id=”Image23″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘ill_06.html’,’nlu.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image25′,”,’gfx/nav/rechts_utrecht_1.gif’,1)”><img src=”gfx/nav/rechts_utrecht_0.gif” name=”Image25″ width=”41″ height=”10″ border=”0″ id=”Image25″ /></a><img src=”gfx/punt_1.gif” width=”4″ height=”10″ /><a href=”javascript:twoFrameChange(‘ill_07.html’,’nla.html’);” onmouseout=”MM_swapImgRestore()” onmouseover=”MM_swapImage(‘Image27′,”,’gfx/nav/aanwezig_1.gif’,1)”><img src=”gfx/nav/aanwezig_0.gif” name=”Image27″ width=”46″ height=”10″ border=”0″ id=”Image27″ /></a></td>

    This is quite a lot of code but it is meant for identifying the problem so I hope it’s ok.

    [url]http://www.boisen.nl/wedding/index.html[/url] contains the problematic document – a lot of the links does not work yet, though you will be able to see the code and my problem.

    I am crossing my fingers,
    The Unseen

    to post a comment
    JavaScript

    0Be the first to comment 😎

    ×

    Success!

    Help @the_unseen spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...