if(typeof myObj=='undefined'){ alert('变量不存在'); }
http://www.ruanyifeng.com/blog/2011/05/how_to_judge_the_existence_of_a_global_object_in_javascript.html