我的代码在打印第一个nodetype就卡住了,错在哪?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>节点属性</title>
</head>
<body>
<ul>
<li>javascript</li>
<li>HTML/CSS</li>
<li>jQuery</li>
</ul>
<script type="text/javascript">
var node = document.getElementsByTagName("li");
var name_list = new Array(10);
name_list[1] = "元素";
name_list[2] = "属性";
name_list[3] = "文本";
name_list[8] = "注释";
name_list[9] = "文档";
document.write(node.length + "<br />");
for(var i = 0; i < node.length; i++){
var index = parseInt(node[i].nodeType);
document.write("name: " + node[i].nodeName + "<br/>");
document.write("value: " + node[i].nodeValue + "<br/>");
document.wirte("type: " + name_list[index] + "<br/>");
document.write("<br/>");
}
</script>
</body>
</html>