打印Dom对象的所有属性和方法

<html>
<head>
    <title>Test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<script language="javascript">

for(myprop in document)
    {
      
    
        if (typeof(document[myprop])=="function"){
        
        
        document.writeln("属性名称:"+myprop+";属性值:"+document[myprop]+"<br>");
        document.writeln(typeof(document[myprop]));
        }
        
        
        /* document.writeln("Document的所有属性:");
        if (typeof(document[myprop])!="function"){
        
        
        document.writeln("属性名称:"+myprop+";属性值:"+document[myprop]+"<br>");
        //document.writeln(typeof(document[myprop]));
        } */
    }
</script>
</head>
<body>
    <p onClick="func();">Menu Bar</p>
    
    <p name="a" style="display:none">item1</p>
    <p name="a" style="display:none">item2</p>
</body>
</html>
原文地址:https://www.cnblogs.com/hubing/p/3245829.html