想用这段代码历遍所有的节点,但是……
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<SCRIPT LANGUAGE="JScript">
function accessAllNodes(para) {
if(para.hasChildNodes)
{
for(i in para.hasChildNodes)
accessAllNodes(para.hasChildNodes[i]);
}
else alert(para.nodeValue);
}
</SCRIPT>
<a href="#" onclick="accessAllNodes(document)">gfdsgfdgfd</a>
</body>
</html>
运行结果是:
点击-->浏览器无响应!