...that's really cool. Going to keep this in mind... thanks! On 6/1/07, Alex Duffield <[EMAIL PROTECTED]> wrote: > > Her is the function I use to load JS files dynamically > It uses a script tag with the id "loadScript" Each time a new script is > loaded it replaces the last one. > > I made this for a web app that loaded up new modules via Ajax. > > > function LoadJS(file){ > var head = document.getElementsByTagName('head').item(0) > var scriptTag = $('loadScript'); > if(scriptTag) head.removeChild(scriptTag); > script = document.createElement('script'); > script.src = file; > script.type = 'text/javascript'; > script.id = 'loadScript'; > head.appendChild(script) > } > > > ______________________________________________________________________ > > *Alex Duffield* *❖* *Principal* *❖* *InControl Solutions* *.* * > http://www.incontrolsolutions.com* <http://www.incontrolsolutions.com/> > > > > > On 1-Jun-07, at 11:38 AM, Thomas K. Nielsen wrote: > > > Hi is it possible to use the Ajax.Updater to add a js file to the head > of my page? Any examples? > > I have previously tried with some dynamically loading with > createElement and appendChild it works - but unfortunately I have > multiple js references and some needs to be loaded before the other - > but when I load them dynamically they don't wait to get loaded - so > sometimes I get an error :( - I have some dependencies in the js files > - so from what I have read on other sites I should use some xmlhttp to > add them - anybody have some suggestions how I can do this? > > Thanks in advance > Regards > Thomas K. Nielsen > > > > > > > >
--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---