1.对象检测 if(document.getElementById){ //支持就执行代码 } //更简便的方式 if(!document.getElementById) return false;//不支持就返回