Anonymous

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromAnonymous
ToMe
Subjectreference a iframe from a different file
Date26 December 2005 17:42
Hello Mark,

First of all excuse me for my poor english.

I'm developing the Annozilla extension for Firefox. In one .xul file I've
got two iframes. In the first iframe I've loaded a DHTML menu and in the
second iframe I'm trying to load some tables depending of the menuitem is
clicked in the DHTML menu.

So, in a .js file of the menú I have a function that decides which table
(which src) must be loaded and I don't know how to reference in this
function the second iframe of the .xul file, to say to the function in which
iframe must be the table loaded.

The problem is that all the ways of referencing a iframe are between files
that have some relation between them, and in this case have nothing in
common. One is a .js file of the DHTML menu and the iframe is in a .xul
file.

So, how can I reference the IFRAME?
I'm using Firefox in [Linux brand] distribution.

This si the code of the function in the .js file:

function hayclick(nueva_clase){

iframe=document.getElementById(Tabla);

direction1="/home/Anonymous/Desktop/TablaPropiedades/AgencyTabla.xul";
direction2="/home/Anonymous/Desktop/TablaPropiedades/ProgramTabla.xul";
direction3="/home/Anonymous/Desktop/TablaPropiedades/OrganizationTabla.xul";
direction4="/home/Anonymous/Desktop/TablaPropiedades/ProjectTabla.xul";
direction5="/home/Anonymous/Desktop/TablaPropiedades/ResearcherTabla.xul";
direction6="/home/Anonymous/Desktop/TablaPropiedades/ArticleTabla.xul";
direction7="/home/Anonymous/Desktop/TablaPropiedades/PresentationTabla.xul";
direction8="/home/Anonymous/Desktop/TablaPropiedades/SoftwareTabla.xul";
direction9="/home/Anonymous/Desktop/TablaPropiedades/WebDocumentTabla.xul";
direction10="/home/Anonymous/Desktop/TablaPropiedades/DocumentTypeTabla.xul";

    if(nueva_clase=="101")    // es PFD?

        alert('Es el 101');
        //iframe.setAttribute("src", direction10);

    else if(nueva_clase=="102")    // es PS?
        
        alert('Es el 102');
        //iframe.setAttribute("src", direction10);

    else if(nueva_clase=="103")    // es DOC?

        alert('Es el 103');
        //iframe.setAttribute("src", direction10);

    else if(nueva_clase=="104")    // es HTML?

        alert('Es el 104');
        //iframe.setAttribute("src", direction10);

    else if(nueva_clase=="105")    // es PPT?

        alert('Es el 105');
        //iframe.setAttribute("src", direction10);

    else if(nueva_clase=="106")    // es EXECUTABLE?

        alert('Es el 106');
        //iframe.setAttribute("src", direction10);

    else if(nueva_clase=="10")    // es Document Type?
        
        alert('Es el 10');
        //iframe.setAttribute("src", direction10);
    
    else if(nueva_clase=="9")    // es Web Document?
        
        alert('Es el 9');
        //iframe.setAttribute("src", direction9);

    else if(nueva_clase=="8")    // es Software?
        
        alert('Es el 8');
        //iframe.setAttribute("src", direction8);

    else if(nueva_clase=="7")    // es Presentation?
        
        alert('Es el 7');
        //iframe.setAttribute("src", direction7);

    else if(nueva_clase=="6")    // es Article?
        
        alert('Es el 6');
        //iframe.setAttribute("src", direction6);

    else if(nueva_clase=="5")    // es Researcher?
        
        alert('Es el 5');
        //iframe.setAttribute("src", direction5);

    else if(nueva_clase=="4")    // es Project?
        
        alert('Es el 4');
        //iframe.setAttribute("src", direction4);

    else if(nueva_clase=="3")    // es Organization?
        
        alert('Es el 3');
        //iframe.setAttribute("src", direction3);

    else if(nueva_clase=="2")    // es Program?
        
        alert('Es el 2');
        //iframe.setAttribute("src", direction2);

    else if(nueva_clase=="1")    //es Agency?
        
        alert('Es el 1');
        //iframe.setAttribute("src", direction1);

    else alert('No se trata de ninguna clase'); 

}

And the the codeof teh .xul file where the iframe I want to reference is
defined:

<vbox flex="1">
                  <label value="Properties"/>


                <hbox flex="1">
                
                  <iframe id="Tabla" name="properties"
                  src="???" flex="1"/>

                 </hbox>
                
              </vbox>

Thanks in advance!!!

Anonymous
FromMe
ToAnonymous
SubjectRe: reference a iframe from a different file
Date27 December 2005 09:31
Anonymous,

You are probably asking the wrong person, since I do not use Firefox, or its
XUL, and I certainly do not use (or particularly like) extensions. However,
assuming it uses frames the same way as any other document, the page in the
first frame should be able to use:

parent.frames[1].window
or
parent.getElementsByTagName('iframe')[1].contentDocument

However, as is common with Firefox's proprietary additions, it may not like
you referencing it directly. It often uses window._content to reference
window objects of frames from XUL or extensions. I have no idea how or where
you would use it though. I suggest you ask someone who knows how to write
Firefox extensions.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.