日期:2014-05-16 浏览次数:20392 次
<body>
<span id="content">
<input type="input" id="notnull" aaa="haha" />
</span>
</body>
<script language="javascript">
var chils = document.getElementById("content").childNodes;
for(var i=0;i<chils.length;i++){
alert(chils[i].aaa);
var class_name = "";
if(navigator.userAgent.indexOf("MSIE")>0) {
alert();
class_name = chils[i].getAttributeNode("aaa");
} else {
alert();
class_name = chils[i].getAttribute("aaa");
}
if (class_name != "") {
alert(class_name);
}
}
//alert(document.getElementById("notnull").getAttribute("aaa"));
</script>
var chils = document.getElementById("content").getElementsByTagName("input");