JS代码
try { if(typeof(eval(funcName))=="function"){ funcName(); } }catch(e){ //alert("not function"); }
JQ代码:
<script type="text/javascript"> function calculateSum() { } // using jQuery if ($.isFunction(window.calculateSum)) calculateSum(); else document.writeln('calculateSum does not exist'); </script>