使用typeof判断function是否存在于上下文
时间:2020-11-15 14:21:00|栏目:JavaScript代码|点击: 次
在窗口加载时,使用typeof判断function是否存在于上下文
<script type="text/javascript">
window.onload = function(){
try{
if(test && typeof(test) == "function"){
test();
}
}catch(e){
alert("方法不存在");
}
}
function test(){
alert("我是test()方法");
}
</script>
栏 目:JavaScript代码
下一篇:使用firebug进行调试javascript的示例
本文标题:使用typeof判断function是否存在于上下文
本文地址:http://www.codeinn.net/misctech/22853.html






