在窗口加载时,使用typeof判断function是否存在于上下文
<script type="text/javascript">
window.onload = function(){
try{
if(test && typeof(test) == "function"){
test();
}
}catch(e){
alert("方法不存在");
}
}
function test(){
alert("我是test()方法");
}
</script>
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“使用typeof判断function是否存在于上下文”评论...