Hello, I currently have extended a class from the ScriptACulous Libary : Ajax.InPlaceEditor . I''m doing an InPlaceCalendarEditor, that i will then integrate in my Rails project (with an helper) : For this, when you click the highlighted text, i generate : A textfield (for the date), and a button that will open a mini DHTML Calendar (Dynarch). All this UI is generated by working with DOM (code is the one from the methode : createEditField) : var calendarDiv = document.createElement("div"); var textField = document.createElement("input"); .. var buttonCalendar = document.createElement("button") .. calendarDiv.appendChild(textField); calendarDiv.appendChild(document.createTextNode("\u00a0\u00a0")); calendarDiv.appendChild(buttonCalendar); But, to open the mini calendar, i need to create a javascript node , so i do like this : var javascript = document.createElement("script"); javascript.setAttribute("type", "text/javascript" ); var code = document.createTextNode( "All my code"); javascript.appendChild(code); Then finally: calendarDiv.appendChild(javascript); When integrating this in a page , all is well displayed (field & button), unless the calendar (when clicking on teh button). The javascript code created by DOM seems not executed... Have you any idea? Thanks laurent --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Gday Laurent, I dont think you can create javascript code like that. var javascript = document.createElement("script"); javascript.setAttribute("type", "text/javascript" ); var code = document.createTextNode( "All my code"); javascript.appendChild(code); You cant add javascript as a DOM element. What sort of code are you putting in there? Can it be executed where your doing the DOM creation stuff? Why does it have to be in there? Keith Laurent wrote:> Hello, > > I currently have extended a class from the ScriptACulous Libary : > Ajax.InPlaceEditor . > I''m doing an InPlaceCalendarEditor, that i will then integrate in my > Rails project (with an helper) : > > For this, when you click the highlighted text, i generate : > > A textfield (for the date), and a button that will open a mini DHTML > Calendar (Dynarch). > All this UI is generated by working with DOM (code is the one from the > methode : createEditField) : > > var calendarDiv = document.createElement("div"); > var textField = document.createElement("input"); > .. > var buttonCalendar = document.createElement("button") > .. > > calendarDiv.appendChild(textField); > calendarDiv.appendChild(document.createTextNode("\u00a0\u00a0")); > calendarDiv.appendChild(buttonCalendar); > > But, to open the mini calendar, i need to create a javascript node , > so i do like this : > > var javascript = document.createElement("script"); > javascript.setAttribute("type", "text/javascript" ); > var code = document.createTextNode( > "All my code"); > javascript.appendChild(code); > > Then finally: > calendarDiv.appendChild(javascript); > > When integrating this in a page , all is well displayed (field & > button), unless the calendar (when clicking on teh button). > The javascript code created by DOM seems not executed... > > Have you any idea? > > Thanks > > laurent > > > > >-- MindVision Interactive Ph: (08) 8212 9544 Fax: (08) 8212 9644 E-Mail: keith-ildoxR50Kj+k+/BmZukYBiV4CK0nxESZKQEueVp/e6I@public.gmane.org Web: www.mindvision.com.au --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Keith Thanks for your quick reply ... What i''m trying to integrate is the Calendar from Dynarch ....http:// www.dynarch.com/projects/calendar/ What i'' currently want to display in place, when clicking the displayed text is this portion of HTML : ...I''ve included in my Layout all the dependencies to CSS stylesheets and Calendar javascript files ... <input class="editor_field" type="text" name="value" style="background- color: rgb(255, 255, 153);"/> <button id="f_trigger_b" type="reset">...</button> <script type="text/javascript">//<![CDATA[ Calendar.setup({ align : "BR", showOthers : true, onClose : closed, button : "f_trigger_b" }); //]]></script> And in fact in my last tests, i saw i''ve missed some scripts...so the Javascript generated by the DOM is well executed ..it Works Laurent...i could send you this once finished... i will see if it''s possible to include this component in Rails later... Thanks again L On 2 mai, 13:47, Keith Pitt <k...-ve2Fw/1u49m1JilXf3s4iIdd74u8MsAO@public.gmane.org> wrote:> Gday Laurent, > > I dont think you can create javascript code like that. > > var javascript = document.createElement("script"); > javascript.setAttribute("type", "text/javascript" ); > var code = document.createTextNode( > "All my code"); > javascript.appendChild(code); > > You cant add javascript as a DOM element. What sort of code are you > putting in > there? Can it be executed where your doing the DOM creation stuff? Why does > it have to be in there? > > Keith > > > > Laurent wrote: > > Hello, > > > I currently have extended a class from the ScriptACulous Libary : > > Ajax.InPlaceEditor . > > I''m doing an InPlaceCalendarEditor, that i will then integrate in my > > Rails project (with an helper) : > > > For this, when you click the highlighted text, i generate : > > > A textfield (for the date), and a button that will open a mini DHTML > > Calendar (Dynarch). > > All this UI is generated by working with DOM (code is the one from the > > methode : createEditField) : > > > var calendarDiv = document.createElement("div"); > > var textField = document.createElement("input"); > > .. > > var buttonCalendar = document.createElement("button") > > .. > > > calendarDiv.appendChild(textField); > > calendarDiv.appendChild(document.createTextNode("\u00a0\u00a0")); > > calendarDiv.appendChild(buttonCalendar); > > > But, to open the mini calendar, i need to create a javascript node , > > so i do like this : > > > var javascript = document.createElement("script"); > > javascript.setAttribute("type", "text/javascript" ); > > var code = document.createTextNode( > > "All my code"); > > javascript.appendChild(code); > > > Then finally: > > calendarDiv.appendChild(javascript); > > > When integrating this in a page , all is well displayed (field & > > button), unless the calendar (when clicking on teh button). > > The javascript code created by DOM seems not executed... > > > Have you any idea? > > > Thanks > > > laurent > > -- > MindVision Interactive > > Ph: (08) 8212 9544 > Fax: (08) 8212 9644 > > E-Mail: k...-ildoxR50Kj+k+/BmZukYBiV4CK0nxESZKQEueVp/e6I@public.gmane.org > Web:www.mindvision.com.au--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
AMA3
2007-May-02 13:25 UTC
adding text to <script> elements (was: Re: In Place Calendar Editor)
Just a note: adding text to <script> elements must be done differently in IE than in other browsers. To make your code cross-browser compatible, use this: var text = "...javascript statements here..."; var script = document.createElement("script"); script.setAttribute("type","text/javascript"); if ( (script.canHaveChildren==null) || script.canHaveChildren ) script.appendChild(document.createTextNode(code)); else script.text = code; Peace, AMA3 ----- Original Message ----- From: "Laurent" <laurent.bois-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> To: "Ruby on Rails: Spinoffs" <rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Sent: Wednesday, May 02, 2007 09:07 Subject: [Rails-spinoffs] Re: In Place Calendar Editor> > Hi Keith > > Thanks for your quick reply ... > > What i''m trying to integrate is the Calendar from Dynarch ....http:// > www.dynarch.com/projects/calendar/ > > What i'' currently want to display in place, when clicking the > displayed text is this portion of HTML : > > ...I''ve included in my Layout all the dependencies to CSS stylesheets > and Calendar javascript files ... > <input class="editor_field" type="text" name="value" style="background- > color: rgb(255, 255, 153);"/> > <button id="f_trigger_b" type="reset">...</button> > <script type="text/javascript">//<![CDATA[ > Calendar.setup({ > align : "BR", > showOthers : true, > onClose : closed, > button : "f_trigger_b" > }); > //]]></script> > > And in fact in my last tests, i saw i''ve missed some scripts...so the > Javascript generated by the DOM is well executed ..it Works > > Laurent...i could send you this once finished... i will see if it''s > possible to include this component in Rails later... > > Thanks again > > L > > > On 2 mai, 13:47, Keith Pitt <k...-ve2Fw/1u49m1JilXf3s4iIdd74u8MsAO@public.gmane.org> wrote: >> Gday Laurent, >> >> I dont think you can create javascript code like that. >> >> var javascript = document.createElement("script"); >> javascript.setAttribute("type", "text/javascript" ); >> var code = document.createTextNode( >> "All my code"); >> javascript.appendChild(code); >> >> You cant add javascript as a DOM element. What sort of code are you >> putting in >> there? Can it be executed where your doing the DOM creation stuff? Why >> does >> it have to be in there? >> >> Keith >> >> >> >> Laurent wrote: >> > Hello, >> >> > I currently have extended a class from the ScriptACulous Libary : >> > Ajax.InPlaceEditor . >> > I''m doing an InPlaceCalendarEditor, that i will then integrate in my >> > Rails project (with an helper) : >> >> > For this, when you click the highlighted text, i generate : >> >> > A textfield (for the date), and a button that will open a mini DHTML >> > Calendar (Dynarch). >> > All this UI is generated by working with DOM (code is the one from the >> > methode : createEditField) : >> >> > var calendarDiv = document.createElement("div"); >> > var textField = document.createElement("input"); >> > .. >> > var buttonCalendar = document.createElement("button") >> > .. >> >> > calendarDiv.appendChild(textField); >> > calendarDiv.appendChild(document.createTextNode("\u00a0\u00a0")); >> > calendarDiv.appendChild(buttonCalendar); >> >> > But, to open the mini calendar, i need to create a javascript node , >> > so i do like this : >> >> > var javascript = document.createElement("script"); >> > javascript.setAttribute("type", "text/javascript" ); >> > var code = document.createTextNode( >> > "All my code"); >> > javascript.appendChild(code); >> >> > Then finally: >> > calendarDiv.appendChild(javascript); >> >> > When integrating this in a page , all is well displayed (field & >> > button), unless the calendar (when clicking on teh button). >> > The javascript code created by DOM seems not executed... >> >> > Have you any idea? >> >> > Thanks >> >> > laurent >> >> -- >> MindVision Interactive >> >> Ph: (08) 8212 9544 >> Fax: (08) 8212 9644 >> >> E-Mail: k...-ildoxR50Kj+k+/BmZukYBiV4CK0nxESZKQEueVp/e6I@public.gmane.org >> Web:www.mindvision.com.au > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Laurent
2007-May-02 14:19 UTC
Re: adding text to <script> elements (was: Re: In Place Calendar Editor)
Ok thanks a lot.... For my use at work, our target browser is FF..but it will be useful when reused later on other projects Laurent On 2 mai, 15:25, "AMA3" <a...-ySNssrZK0L0@public.gmane.org> wrote:> Just a note: adding text to <script> elements must be done differently in > IE than in other browsers. To make your code cross-browser compatible, use > this: > > var text = "...javascript statements here..."; > var script = document.createElement("script"); > script.setAttribute("type","text/javascript"); > if ( (script.canHaveChildren==null) || script.canHaveChildren ) > script.appendChild(document.createTextNode(code)); > else > script.text = code; > > Peace, > AMA3 > > ----- Original Message ----- > From: "Laurent" <laurent.b...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > To: "Ruby on Rails: Spinoffs" <rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Sent: Wednesday, May 02, 2007 09:07 > Subject: [Rails-spinoffs] Re: In Place Calendar Editor > > > Hi Keith > > > Thanks for your quick reply ... > > > What i''m trying to integrate is the Calendar from Dynarch ....http:// > >www.dynarch.com/projects/calendar/ > > > What i'' currently want to display in place, when clicking the > > displayed text is this portion of HTML : > > > ...I''ve included in my Layout all the dependencies to CSS stylesheets > > and Calendar javascript files ... > > <input class="editor_field" type="text" name="value" style="background- > > color: rgb(255, 255, 153);"/> > > <button id="f_trigger_b" type="reset">...</button> > > <script type="text/javascript">//<![CDATA[ > > Calendar.setup({ > > align : "BR", > > showOthers : true, > > onClose : closed, > > button : "f_trigger_b" > > }); > > //]]></script> > > > And in fact in my last tests, i saw i''ve missed some scripts...so the > > Javascript generated by the DOM is well executed ..it Works > > > Laurent...i could send you this once finished... i will see if it''s > > possible to include this component in Rails later... > > > Thanks again > > > L > > > On 2 mai, 13:47, Keith Pitt <k...-ve2Fw/1u49m1JilXf3s4iIdd74u8MsAO@public.gmane.org> wrote: > >> Gday Laurent, > > >> I dont think you can create javascript code like that. > > >> var javascript = document.createElement("script"); > >> javascript.setAttribute("type", "text/javascript" ); > >> var code = document.createTextNode( > >> "All my code"); > >> javascript.appendChild(code); > > >> You cant add javascript as a DOM element. What sort of code are you > >> putting in > >> there? Can it be executed where your doing the DOM creation stuff? Why > >> does > >> it have to be in there? > > >> Keith > > >> Laurent wrote: > >> > Hello, > > >> > I currently have extended a class from the ScriptACulous Libary : > >> > Ajax.InPlaceEditor . > >> > I''m doing an InPlaceCalendarEditor, that i will then integrate in my > >> > Rails project (with an helper) : > > >> > For this, when you click the highlighted text, i generate : > > >> > A textfield (for the date), and a button that will open a mini DHTML > >> > Calendar (Dynarch). > >> > All this UI is generated by working with DOM (code is the one from the > >> > methode : createEditField) : > > >> > var calendarDiv = document.createElement("div"); > >> > var textField = document.createElement("input"); > >> > .. > >> > var buttonCalendar = document.createElement("button") > >> > .. > > >> > calendarDiv.appendChild(textField); > >> > calendarDiv.appendChild(document.createTextNode("\u00a0\u00a0")); > >> > calendarDiv.appendChild(buttonCalendar); > > >> > But, to open the mini calendar, i need to create a javascript node , > >> > so i do like this : > > >> > var javascript = document.createElement("script"); > >> > javascript.setAttribute("type", "text/javascript" ); > >> > var code = document.createTextNode( > >> > "All my code"); > >> > javascript.appendChild(code); > > >> > Then finally: > >> > calendarDiv.appendChild(javascript); > > >> > When integrating this in a page , all is well displayed (field & > >> > button), unless the calendar (when clicking on teh button). > >> > The javascript code created by DOM seems not executed... > > >> > Have you any idea? > > >> > Thanks > > >> > laurent > > >> -- > >> MindVision Interactive > > >> Ph: (08) 8212 9544 > >> Fax: (08) 8212 9644 > > >> E-Mail: k...-ildoxR50Kj+k+/BmZukYBiV4CK0nxESZKQEueVp/e6I@public.gmane.org > >> Web:www.mindvision.com.au--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---