判断function是否存在于上下文

来源:互联网 发布:致信oa端口 编辑:程序博客网 时间:2024/05/16 11:12
<script type="text/javascript"> window.onload = function(){  try{   if(test && typeof(test) == "function"){    test();   }  }catch(e){   alert("方法不存在");  } } function test(){  alert("我是test()方法"); }</script>


0 0
原创粉丝点击