*Tab+spacebar and it posts :P You could put your list of functions in an array in your external js, then call them on the window object in a loop: $(function() { var funcs = [ 'ManageCategoriesClick', 'HideByDefault', 'PrepareSplitForm', 'SetUpAdvertPopup', 'CheckAll', 'CheckNone', 'EditCategoryInPlace', 'PreparePaneLinks', 'PrepareToolTips' ]
$.each(funcs,function(i,f){ if(typeof(window[f]) == 'function'){ window[f](); } }); }); On Feb 8, 5:21 am, Beau <zar...@gmail.com> wrote: > Thanks for the ideas everyone! > > @Stephan: Yes, it's in an external JS file. I'd prefer to not have to > do any inline javascript. I've considered it, but thanks for the > suggestion! > > @Ricardo: Thanks for those. I may end up doing a variation of them. > > On Feb 8, 4:50 am, Stephan Veigl <stephan.ve...@gmail.com> wrote: > > > Hi > > > I guess you have your $().ready() function in an external js file, > > otherwise you could > > customize it for the according html page. > > > Another construct similar to Ricardos one, but a bit more flexible: > > > Use a global variable in every html file to specify the init functions > > you want to call for this page: > > <script type="text/javascript"> > > myInitFxn = [ManageCategoriesClick, HideByDefault, > > PrepareSplitForm,...]; > > </script> > > > ready.js: > > $().ready(function(){ > > for(var i in myInitFxn) { > > myInitFxn[i](); // call init function > > } > > > }); > > > by(e) > > Stephan > > > 2009/2/8 brian <bally.z...@gmail.com>: > > > > On Sat, Feb 7, 2009 at 11:21 PM, Ricardo Tomasi <ricardob...@gmail.com> > > > wrote: > > > >> Alternatively you could add a different class to the body of each > > >> page, then use this rather amusing construct: > > > >> $(document).ready((function(){ > > >> var is = function(v){ return ++document.body.className.indexOf(v) }; > > > >> return( > > >> is('categories') > > >> ? ManageCategoriesClick : > > >> is('hidebydefault') > > >> ? HideByDefault : > > >> is('form') > > >> ? PrepareSplitForm : > > >> is('advert') > > >> ? SetUpAdvertPopup : > > >> function(){} //nothing > > >> ); > > > >> })()); > > > > That is, indeed, amusing. And one for my toy chest. Thanks! > > > > Who knew, back in '96, that javascript was going to turn out to be so > > > much fun?