程序运行到红色部分就出错,提示说NodeFilter未定义,求指教????
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
//NodeIterator
var iterator = null;
function makeList(){
var oDiv = document.getElementById("div1");
var oFilter = new Object;
oFilter.acceptNode = function(oNode){
return (oNode.tagName == "p") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
};
iterator = document.createNodeIterator(oDiv, NodeFilter.SHOW_ELEMENT, oFilter, false);
var oOutput = document.getElementById("text1");
var oNode = iterator.nextNode();
while(oNode){
oOutput.value += oNode.tagName + "\n";
oNode = iterator.nextNode();
}
}
</script>
</head>
<body>
<div >
<p align="left">hello <b>world!</b></p>
<ul>
<li>List item1</li>
<li>List item2</li>
<li>List item3</li>
</ul>
</div>
<textarea rows="10" cols="40"></textarea><br />
<input type="button" name="testBtn" value="测试" onclick="makeList()"/>
</body>
</html>