87,915
社区成员
发帖
与我相关
我的任务
分享
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
<script>
HTMLElement.prototype.__defineGetter__("children",
function () {
var returnValue = new Object();
var number = 0;
for (var i=0; i<this.childNodes.length; i++) {
if (this.childNodes[i].nodeType == 1) {
returnValue[number] = this.childNodes[i];
number++;
}
}
returnValue.length = number;
return returnValue;
}
);
//alert("<div>"+a+"</div>")
</script>
</HEAD>
<BODY>
<div onclick="alert('childNodes:'+this.childNodes.length+'\nchildren:'+this.children.length);">
aaa <input type="button" value="bbb"/> ccc <input type="button" value="ddd" /> eee
</div>
</BODY>
</HTML>