1 var fun = "testFun"; // 函数的名称 2 try{ 3 if($.isFunction(fun)){ eval("testFun('txt')"); // "txt"是函数参数5 } 6 }catch(e){ 7 $.alert(fun +'不是函数!'); 8 }
注意使用“eval()”!!!