Note that there are some explanatory texts on larger screens.

plurals
  1. POAccessing a frame within a frame
    primarykey
    data
    text
    <p>Ok, here is the situation. I have a site that I subscribe to that lets you add your own code, etc. They have a forum editor that I am unable to skin to match my site, so I'd like to just change the colors of the inner most frame (doc3 in the example below).</p> <p>Here is the basic setup... yes, all documents are from within the same domain but I can only add code to the main document. The doc3 frame is created dynamically. The first frame has a class but no name, the second only has an id... I don't know if the bind works for the inner frame, but firebug isn't giving me any errors.</p> <p>Oh, and I have tried injecting a stylesheet as well without success.</p> <p><strong>Main document</strong> (with my attempts at accessing doc3)</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $('iframe').bind('load', function(){ $(this).contents().find('body').css({'background-color':'#333333','color':'#ddd'}); // This does change doc2 colors $(this).contents().find('iframe#doc3').bind('load', function(){ $(this).contents().find('body').css({'background-color':'#333333','color':'#ddd'}); // doesn't work :( }) }) }) &lt;/script&gt; &lt;/head&gt; &lt;body&gt; Document #1 &lt;iframe class="postFrame" src="doc2.htm" width="100%" height="300"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>doc2.htm</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1"&gt; Document #2 &lt;iframe id="doc3" src="doc3.htm" width="100%" height="250"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>doc3.htm</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body style="background-color:#fff; color:#000;"&gt; &lt;!-- access this body style --&gt; Document #3 &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I hope I made this clear enough. Any help or a point in the right direction would be greatly appreciated :)</p> <p>Edit: updated the Main document with the suggestion from Wahnfrieden (thanks!), but sadly I still can't get to doc3.htm</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload