Hi, I''m using HttpRequest in one application and I want to use RichTextEditor too. The problem is: To insert RTE the page need to run a javascript function and when I do a HttpRequest and insert by innerHTML the javascripts don''t run!! What is the solution for this problem? Thank you -- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035
Try using the DOM to insert your html elements and not innerHTML .. then you can call the javascript functions directly while working through the DOM elements. On 4/29/05, Pedro Valentini <pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org> wrote:> > Hi, > I''m using HttpRequest in one application and I want to use > RichTextEditor too. > The problem is: > To insert RTE the page need to run a javascript function and when I do a > HttpRequest and insert by innerHTML the javascripts don''t run!! > What is the solution for this problem? > > Thank you > > -- > > Pedro C. Valentini > pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org > +55 (21) 8708-8035 > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- - Ramin http://www.getintothis.com/blog _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Humm.. I''m trying to insert all RTE in a DIV and move this DIV to other div in the code that I got from HttpRequest. But how I move this div with all objects, events, etc ? I''m trying: var rtesource = document.getElementById(''rtesource''); document.getElementById(''rtesource'').parentNode.removeChild(document.getElementById(''rtesource'')); document.getElementById(''rte_new_box'').appendChild(rteSource); Thank you.. Ramin escreveu:> Try using the DOM to insert your html elements and not innerHTML .. > then you can call the javascript functions directly while working > through the DOM elements. > > On 4/29/05, *Pedro Valentini* <pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org > <mailto:pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org>> wrote: > > Hi, > I''m using HttpRequest in one application and I want to use > RichTextEditor too. > The problem is: > To insert RTE the page need to run a javascript function and when > I do a > HttpRequest and insert by innerHTML the javascripts don''t run!! > What is the solution for this problem? > > Thank you > > -- > > Pedro C. Valentini > pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org <mailto:pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org> > +55 (21) 8708-8035 > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <mailto:Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > -- > - Ramin > http://www.getintothis.com/blog > >------------------------------------------------------------------------ > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > >-- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Two thins I noticed here... 1. You are using two seperate variables here, rtesource and rteSource (notice the capital S). You should''ve gotten a javascript error if rteSource wasn''t defined. So not sure if this was a typo or not. 2. You can make your code a bit cleaner by doing this: var rtesource = document.getElementById(''rtesource''); if(rtesource) { var rteparent = rtesource.parentNode; rteparent.removeChild(rtesource); document.getElementById(''rte_new_box'').appendChild(rtesource); } give that a try and see if it makes any difference. On 4/29/05, Pedro Valentini <pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org> wrote:> > > Humm.. > I''m trying to insert all RTE in a DIV and move this DIV to other div in > the code that I got from HttpRequest. > But how I move this div with all objects, events, etc ? > > I''m trying: > var rtesource = document.getElementById(''rtesource''); > document.getElementById(''rtesource'').parentNode.removeChild( > document.getElementById(''rtesource'')); > document.getElementById(''rte_new_box'').appendChild(rteSource); > > Thank you.. > > > Ramin escreveu: > > Try using the DOM to insert your html elements and not innerHTML .. then > you can call the javascript functions directly while working through the DOM > elements. > > On 4/29/05, Pedro Valentini <pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org> wrote: > > > > Hi, > > I''m using HttpRequest in one application and I want to use > > RichTextEditor too. > > The problem is: > > To insert RTE the page need to run a javascript function and when I do a > > HttpRequest and insert by innerHTML the javascripts don''t run!! > > What is the solution for this problem? > > > > Thank you > > > > -- > > > > Pedro C. Valentini > > pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org > > +55 (21) 8708-8035 > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > - Ramin > http://www.getintothis.com/blog > > ------------------------------ > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > -- > > Pedro C. Valentini > pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org > +55 (21) 8708-8035 > >-- - Ramin http://www.getintothis.com/blog _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hi, I saw this, and it is not the error. Can you see other error? Thank''s Ramin escreveu:> Two thins I noticed here... > > 1. You are using two seperate variables here, rtesource and rteSource > (notice the capital S). You should''ve gotten a javascript error if > rteSource wasn''t defined. So not sure if this was a typo or not. > > 2. You can make your code a bit cleaner by doing this: > > var rtesource = document.getElementById(''rtesource''); > if(rtesource) { > var rteparent = rtesource.parentNode; > > rteparent.removeChild(rtesource); > document.getElementById(''rte_new_box'').appendChild(rtesource); > } > > give that a try and see if it makes any difference. > > > On 4/29/05, *Pedro Valentini* <pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org > <mailto:pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org>> wrote: > > > Humm.. > I''m trying to insert all RTE in a DIV and move this DIV to other > div in the code that I got from HttpRequest. > But how I move this div with all objects, events, etc ? > > I''m trying: > var rtesource = document.getElementById(''rtesource''); > document.getElementById(''rtesource'').parentNode.removeChild(document.getElementById(''rtesource'')); > document.getElementById(''rte_new_box'').appendChild(rteSource); > > Thank you.. > > > Ramin escreveu: > >> Try using the DOM to insert your html elements and not innerHTML >> .. then you can call the javascript functions directly while >> working through the DOM elements. >> >> On 4/29/05, *Pedro Valentini* <pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org >> <mailto:pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org>> wrote: >> >> Hi, >> I''m using HttpRequest in one application and I want to use >> RichTextEditor too. >> The problem is: >> To insert RTE the page need to run a javascript function and >> when I do a >> HttpRequest and insert by innerHTML the javascripts don''t run!! >> What is the solution for this problem? >> >> Thank you >> >> -- >> >> Pedro C. Valentini >> pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org <mailto:pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org> >> +55 (21) 8708-8035 >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <mailto:Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> >> >> -- >> - Ramin >> http://www.getintothis.com/blog >> >>------------------------------------------------------------------------ >> >>_______________________________________________ >>Rails mailing list >> >>Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org <mailto:Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> >>http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> > >-- > >Pedro C. Valentini >pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org <mailto:pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org> >+55 (21) 8708-8035 > > > > > > -- > - Ramin > http://www.getintothis.com/blog-- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035 _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails