Home  >  Article  >  Web Front-end  >  Object feature detection method to determine browser support for javascript objects_javascript skills

Object feature detection method to determine browser support for javascript objects_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:49:29888browse
Copy code The code is as follows:

if(document.getElementById)
{
alert( document.getElementById);//output: function getElementById(){ [native code] };
}

As in the above example, this method determines whether the browser supports the getElementById() method. Note , here the detection object in the if statement does not have brackets "()".
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn