欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用typeof判斷function是否存在于上下文

 更新時間:2014年08月14日 17:38:17   投稿:whsnow  
這篇文章主要介紹了使用typeof判斷function是否存在于上下文,在窗口加載時,使用typeof進(jìn)行判斷,需要的朋友可以參考下

在窗口加載時,使用typeof判斷function是否存在于上下文

<script type="text/javascript"> 
window.onload = function(){ 
try{ 
if(test && typeof(test) == "function"){ 
test(); 
} 
}catch(e){ 
alert("方法不存在"); 
} 
} 
function test(){ 
alert("我是test()方法"); 
} 
</script>

相關(guān)文章

最新評論