If the function is always global, you could use: function ajax_loadpage(x_func){ //... window[x_func](); }; ajax_loadpage('inittabFeeds');
Better than that would be passing the function object itself, if it's in scope: function ajax_loadpage(x_func){ //... x_func(); }; ajax_loadpage(inittabFeeds); Better yet would be to use an object to store all your functions so you don't need ugly hacks (similar to the first option): myStuff = { inittabFeeds: function(){ //... } }; function ajax_loadpage(x_func){ //... myStuff[x_func](); }; ajax_loadpage('inittabFeeds'); Using eval is slow and could be unsecure depending on your app, it's best to avoid it. On Jun 20, 5:24 am, Davis <ywk...@gmail.com> wrote: > Hello; > > i want pass a JS function name into a function and call it. > > <a onclick="javascript:ajax_loadpage('inittabFeeds()');">babababa</a> > > function ajax_loadpage(x_func) > { > // how can i call inittabFeeds() which stored in x_func variable ? > > } > > many thanks/Davis.