如何判断一个函数是否存在或者定义?
---------------------------------------------------------------
use typeof
1<script>
2
3function getsdf2(){
4
5}
6alert(typeof( getsdf2))
7alert(typeof( getsdf21))
8</script>
---------------------------------------------------------------
vbs:isEmpty(function_name)=true
js:typeof(function_name)==function
---------------------------------------------------------------
如果存在则type是function
否则是undefined
---------------------------------------------------------------
if (typeof FunctionName) == "function")
{
alert(FunctionName);
}
else
{
alert("not a function");
}