Try passing the frame as the context for the selector:

<frameset rows="50,50" frameborder="no" border="0" framespacing="0">
  <frame src="frame2.html" name="mainFrame" title="mainFrame" />
  <frame src="frame1.html" scrolling="No" noresize="noresize"
name="bottomFrame" title="bottomFrame" />
</frameset>

$(document).ready(function(){
   var bottom = frames['bottomFrame'], main = frames['mainFrame'];
   var iframe = $('#adDiv iframe', main);

   $('#destinationDiv', bottom).append(iframe);
});

On Nov 10, 8:59 am, BananaHead <[EMAIL PROTECTED]> wrote:
> Hello!
>
> I have tried this with the advice of a few in #jquery channel on
> Freenode and I cant get this to work.
>
> Here is my situation:
>
> I have a frameset with 2 frames: One's frame source is frame1.html
> (with Id of "bottomFrame") and frame2.html ( with id of "mainFrame").
>
> mainFrame source (frame2.html) has a div tag with the id of "adDiv"
> and this div tag contains an Iframe.
> bottomFrame source (frame1.html) has a div tag with the id of
> "destinationDiv".
>
> I am trying to move the contents of "adDiv" (the iframe) from
> frame2.html to "destinationDiv" (frame1.html). I cant get it to work.
> I have tried the frameReady plugin (dunno if this is its purpose), but
> I cant get anything to work. Can i achieve this by only using jquery?
>
> Here is the code:
>
> //======================================================
>
> <title>Untitled Document</title>
>        <script type="text/javascript" src="jquery-1.2.6.js"></script>
>        <script>
>
>            $(document).ready(function(){
>
>                         $("#mainFrame").find("#adDiv iframe").appendTo( $
> ("#bottomFrame").find("#destinationDiv") );
>
> });
>
> </script>
> </head>
>
> <frameset rows="50,50" frameborder="no" border="0" framespacing="0">
>   <frame src="frame2.html" id="mainFrame" title="mainFrame" />
>   <frame src="frame1.html" scrolling="No" noresize="noresize"
> id="bottomFrame" title="bottomFrame" />
> </frameset>
> <noframes><body>
> </body>
> </noframes></html>
>
> I have also tried contents().find , but I have no idea how to work all
> this out. Im a noob yet with Jquery.
>
> Is the frameReady needed and what syntax? I have tried the same above
> code (and contents().find ) and I cant get anything to work.
>
> I would love is somebody could guide me on how to get this to work!
>
> Thanks
> Eric

Reply via email to