yeah! it works! thanks!

On Aug 13, 9:45 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> You are getting the head tag correctly (heads is an array with one element),
> but the code probably ends up trying to set the innerHTML of a DIV in the
> current document (not the iframe) in order to convert the <link> HTML to DOM
> elements. If that conversion works, the LINK element belongs to the wrong
> document, and some browsers won't let you append it to a different document.
>
> Try this instead:
>
>     // Add a linked stylesheet to a specific document.
>     // Use the current document if doc is omitted.
>     function addStylesheet( file, doc ) {
>         doc = doc || document;
>         var head = doc.getElementsByTagName('head')[0];
>         var link = doc.createElement( 'link' );
>         link.rel = 'stylesheet';
>         link.type = 'text/css';
>         link.href = file;
>         head.appendChild(  link );
>     }
>
>     addStylesheet( 'selector.css', frameDocument );
>
> -Mike
>
> > From:julio
>
> > I get a document in iframe with IE with this:
> > frame = $doc.frames['myframe'];
> > frameDocument = frame.document;
>
> > and it works correctly.
>
> > but how can I get head tag to modify its content?
> > this doesn't work:
>
> > var heads = frameDocument.getElementsByTagName("head");
> > $(heads).append("<link rel='stylesheet' type='text/css'
> > href='selector.css' />");

Reply via email to