Thanks Michael and thanks Brandon. I got it. ~_~
On 9/23/07, Michael Geary <[EMAIL PROTECTED]> wrote: > > Glad to help. BTW, the code below looks like it should work with one > simple change: > > $('#test-div').click(function(){ > //window.parent.addData($('p').clone()); > window.parent.addData( $('p').html() ); > }); > That will pass pure HTML text to addData()'s append() call instead of a > cloned node. > > -Mike > > ------------------------------ > *From:* jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] *On > Behalf Of *Brandon Aaron > *Sent:* Saturday, September 22, 2007 10:07 AM > *To:* jquery-en@googlegroups.com > *Subject:* [jQuery] Re: jquery 1.2.1 bug (copy iframe data to parent bug) > > Thanks for clearing that up Michael! :) > > -- > Brandon Aaron > > On 9/22/07, Michael Geary <[EMAIL PROTECTED]> wrote: > > > > Just to clarify, code inside an iframe from the same domain as its > > parent *can* manipulate the DOM in the parent, and vice versa. > > > > What you can't do is move or copy DOM nodes between them. But innerHTML > > would work fine - you could get the innerHTML of the elements in the frame > > and then set the innerHTML of an element in the parent. That would work > > because no actual DOM nodes are moved between windows. > > > > -Mike > > > > ------------------------------ > > *From:* Brandon Aaron > > This is a security limitation in IE and I believe Firefox 3 will have > > it as well. > > > > -- > > Brandon Aaron > > > > On 9/21/07, linuja < [EMAIL PROTECTED]> wrote: > > > > > > copy the data in iframe to its parent. It works fine in firefox and > > > opera, bug it can't in ie(both ie6 and ie7). > > > > > > here is the test case. > > > > > > the main html file code : > > > <?xml version="1.0" encoding="UTF-8"?> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > > > > > > > > <html xmlns="http://www.w3.org/1999/xhtml"> > > > <head> > > > <meta http-equiv="Content-Type" content="text/html; > > > charset=utf-8" /> > > > > > > <script type="text/javascript" > > > src="../../scripts/jquery/jquery.pack.js"></script> > > > <script type="text/javascript"> > > > var addData = function($data){ > > > $('#test-data').append($data); > > > }; > > > </script> > > > </head> > > > > > > <body> > > > <div id="test-data"></div> > > > <iframe src="datas/full- html-data1.html"></iframe> > > > </body> > > > </html> > > > > > > and here is the iframe html file code: > > > <?xml version="1.0" encoding="UTF-8"?> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd > > > "> > > > > > > <html xmlns=" http://www.w3.org/1999/xhtml"> > > > <head> > > > <meta http-equiv="Content-Type" content="text/html; > > > charset=utf-8" /> > > > > > > <script type="text/javascript" > > > src="../../../scripts/jquery/jquery.pack.js"></script> > > > <script type="text/javascript"> > > > $(function(){ > > > $('#test-div').click(function(){ > > > window.parent.addData($('p').clone()); > > > }); > > > }); > > > </script> > > > </head> > > > > > > <body> > > > <div id="test-div">click me</div> > > > <p>test</p> > > > </body> > > > </html> > > > > > > when click the "click me", the __<p>test</p>__ should be append in the > > > <div id="test-data"></div>. It worked in firefox and opera, but can't in > > > ie6 > > > and ie7. > > > > > > thanks~ > > > > > > > >