读书人

js 判断js函数、变量是不是存在

发布时间: 2013-09-25 11:02:59 作者: rapoo

js 判断js函数、变量是否存在

//是否存在指定函数
function isExitsFunction(funcName){
try{
if(typeof(eval(funcName))=="function"){
return true;
}
}catch(e){
}
return false;
}
//是否存在指定变量
function isExitsVariable(variableName){
try{
if(typeof(variableName)=="undefined"){
//alert("value is undefined");
return false;
}else{
//alert("value is true");
return true;
}
}catch(e){
}
return false;
}


http://blog.csdn.net/liang4571231/article/details/4042519

读书人网 >JavaScript

热点推荐