I have tried to directly use the window reference. i.e. var abc = ref.document.getElementById("abc1"); abc.parentNode.removeChild(abc);
The result is correct that the input box in popup windows being removed. Seems that jQuery cannot use popup window reference? On 10/17/06, Jacky <[EMAIL PROTECTED]> wrote: > Dear all, > > I would like to make a simple popup which would copy current page > content and do some conversion (e.g. text box to text). But I have met > a problem of getting a wrong reference. Here is the code to > demonstrate the problem: > > <html> > <head> > <title>Test Popup</title> > <script type="text/javascript" src="jquery.js"></script> > <script type="text/javascript"> > $(document).ready(function(){ > $("#popup").click(specificPop); > > function specificPop(){ > var ref = genericPopup(); > $(ref.document).find("#popup_body > #abc1").remove(); > } > > function genericPopup(){ > var ref = > window.open('','','resizable=1,width=400,height=400'); > var diva = $("#diva").clone(); > ref.document.open(); > > ref.document.write('<html><head><title>Popup</title></head>'); > ref.document.write('<body > id="popup_body">'); > ref.document.write($(diva).html()); > ref.document.write('</body></html>'); > ref.document.close(); > return ref; > } > }); > </script> > </head> > <body> > <div id="diva"> > <input type="text" id="abc1" value="111"/> > <input type="text" id="abc2" value="222"/> > </div> > <a href="#" id="popup">popup</a> > </body> > </html> > > In this example, I would expect the text box #abc1 in the popup is > removed. But it removes current window's one instead. For the removal > code, I have tried the following approaches: > > $(ref.document).find("#abc1").remove(); > $(ref.document).find("#popup_body #abc1").remove(); > $("#popup_body #abc1",ref.document).remove(); > $(ref.document).find("#popup_body #abc1",ref.document).remove(); > > but all failed. Any idea how can I can the correct reference?? > > P.S. using jQ ver 1.0.2 > -- > Best Regards, > Jacky > http://jacky.seezone.net > -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/