js判断函数是否存在、判断是否为函数

代码:

            <script type="text/javascript">
            //判断是否为函数
            try {
                if(typeof FunName === "function") { //是函数    其中 FunName 为函数名称
                    alert("is function");
                } else { //不是函数
                    alert("not is function");

                }
            } catch(e) {}
            
        </script>

 

posted @ 2016-10-24 20:24  赛跑的蜗牛  阅读(53996)  评论(0编辑  收藏  举报