Re: [jQuery] Popup window reference problem
So, I should: 1. includes jQuery library in popup. 2. call ref.$() where ref is the window reference created in window.open? On 10/19/06, Blair McKenzie [EMAIL PROTECTED] wrote: The only way I know of to use jQuery in another window/frame is to include jquery in that page's html, and then access it using window.$(). Blair On 10/19/06, Jacky [EMAIL PROTECTED] wrote: 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 titleTest 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('htmlheadtitlePopup/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=popuppopup/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/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Best Regards, Jacky 網絡暴民 http://jacky.seezone.net ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Popup window reference problem
That's what I've done. It may be possible to do it another way, but I haven't had the time to experiment.BlairOn 10/19/06, Jacky [EMAIL PROTECTED] wrote:So, I should:1. includes jQuery library in popup. 2. call ref.$()where ref is the window reference created in window.open?On 10/19/06, Blair McKenzie [EMAIL PROTECTED] wrote: The only way I know of to use jQuery in another window/frame is to include jquery in that page's html, and then access it using window.$(). Blair On 10/19/06, Jacky [EMAIL PROTECTED] wrote: 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 titleTest 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('htmlheadtitlePopup/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=popuppopup/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/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/--Best Regards, Jacky網絡暴民 http://jacky.seezone.net___jQuery mailing listdiscuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Popup window reference problem
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 titleTest 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('htmlheadtitlePopup/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=popuppopup/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/
Re: [jQuery] Popup window reference problem
The only way I know of to use jQuery in another window/frame is to include jquery in that page's html, and then access it using window.$().BlairOn 10/19/06, Jacky [EMAIL PROTECTED] wrote: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 titleTest Popup/title script type=text/_javascript_ src=""> 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('htmlheadtitlePopup/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=popuppopup/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 listdiscuss@jquery.comhttp://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] Popup window reference problem
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 titleTest 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('htmlheadtitlePopup/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=popuppopup/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 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/