getElementById Object doesn't support this property or method

代码:

master_headertop =document.getElementById('master_headertop');
if (master_headertop)
      master_headertop.style.display = 'none';

错误提示:

Object doesn't support this property or method.

 

更正为:

var master_headertop =document.getElementById('master_headertop');
if (master_headertop)
        master_headertop.style.display = 'none';

 

 

以下也是错误的:

getElementById('master_headertop').style.display = 'none';

你可能感兴趣的:(getElementById Object doesn't support this property or method)