日期:2014-05-16 浏览次数:20410 次
<form id="form1">
<input type="text" value="fdsa" />
<input type="button" value="btn" />
</form>
<script type="text/javascript">
function nodeContent(e) {
var type, child, s, nodename = "";
for (child = e.firstChild; child != null; child=child.nextSibling) {
type = child.nodeType;
nodename = child.nodeName;
document.write("nodeName:" + nodename + "的nodeType是:" + type + "<br />")
}
}
var ele = document.getElementById("form1");
nodeContent(ele);
</script>
<form id="form1">
<input type="text" value="fdsa" />
<input type="button" value="btn" />
</form>
<form id="form1"><input type="text" value="fdsa" /><input type="button" value="btn" /></form>