您的位置:首页 > 其它

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

2013-08-08 15:01 806 查看
<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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: