2013年10月7日

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

摘要: 本文转自:http://blog.csdn.net/liang4571231/article/details/4042519在进行js编程时,总会出现可能一些函数或者变量未定义而被引用,导致报错的情况。为了避免此类事情的发生,可以在调用前判断函数是否已经被定义。函数:try { if(typeof(eval(funcName))=="function") { funcName(); } }catch(e) { alert("not function"); } 变量:function check() { if (typeof(myvalue)==" 阅读全文

posted @ 2013-10-07 10:05 freeliver54 阅读(9002) 评论(0) 推荐(1)

导航