PDA

View Full Version : Question about loading javascript and css dynamically



jonlb
26 Sep 2007, 12:55 PM
So I've spent the last two days googling and searching the forums as well as reading the Ext docs and I haven't been able to find an answer to my question. I realize this is probably something easy that I've overlooked so if someone can point me to the proper place in the docs or elsewhere to read I would appreciate it.

Here's what I'm looking to do....

I'm developing an application that will contain quite a few Javascript objects. Each of these objects may or may not be needed when the application runs dependent on what options the user chooses. I'd like to be able to load a javascript and/or css file as a reaction to a user choice and then run the object in the javascript file.

I imagine this is possible, I just can't seem to find the solution. Pointers on where to look are greatly appreciated.

Thanks!
jonlb

fay
26 Sep 2007, 1:51 PM
JS: If you search the forums for eval you should get plenty of hits. These seem to be relevant to what you want:



http://extjs.com/forum/showthread.php?p=61204#post61204
http://extjs.com/forum/showthread.php?p=61260#post61260


CSS: See swapStyleSheet (http://extjs.com/deploy/ext/docs/output/Ext.util.CSS.html).

EDIT: jonlb, if you get it working will you post an example of it.