慕用8929199
2019-05-08 10:42
<script type="text/javascript">
var Li=document.getElementsByTagName("li");
for(var i = 0;i<Li.length; i++){
Li[i].nodeName="li";
Li[i].nodeValue="li";
Li[i].nodeType="li";
document.write(Li[i]+"<br>");
}
</script>
<script type="text/javascript">
var lists=document.getElementsByTagName("li");
for(var i=0;i<lists.length;i++)
{
document.write(lists[i].nodeName+"<br />");
document.write(lists[i].nodeValue+"<br />");
document.write(lists[i].nodeType+"<br />");
}
</script>
<script type="text/javascript">
var lists=document.getElementsByTagName("li");
for(var i=0;i<lists.length;i++)
{
document.write(lists[i].nodeName+"<br />");
document.write(lists[i].nodeValue+"<br />");
document.write(lists[i].nodeType+"<br />");
}
</script>
<!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 t=document.getElementsByTagName("li");
for(var i=0;i<t.length;i++)
{
var j=i+1;
document.write("第"+j+"个结点的nodeName:"+t[i].nodeName+" "+"nodeValue:"+t[i].nodeValue+" "+"nodeType:"+t[i].nodeType+"<br/>");
}
</script>
</body>
</html>
<script type="text/javascript">
var aa = document.getElementsByTagName("li");
for(var i=0;i<aa.length;i++)
{
document.write(aa[i].nodeName );
document.write(aa[i].nodeValue );
document.write(aa[i].nodeType +"</br>");
}
</script>
JavaScript进阶篇
468195 学习 · 21891 问题
相似问题