判断访问者用的浏览器支不支持document.getElementById这个方法,如果不支持也不至于报错就是没反应罢了 document.all 只有IE支持 document.layers 只有Netscape支持 document.getElementById 是符合W3C标准