Home > Article > Web Front-end > Please ask a simple question_html/css_WEB-ITnose
<script> <br> var divs=document.getElementsByTagName("div"); <br> var ruku; <br> var banhao; <br> var tmp; <br> for(var i=0; i<divs.length;i ) <br /> { <br /> if(divs[i].innerHTML=="Page Display") <br /> { <br /> ruku=divs[i].parentNode.nextSibling.firstChild; //Why can't this be achieved using the comment section below? <br /> } <br /> } <br /> <br /> <br /> ruku=divs[i].parentNode.nextSibling.childNodes; <br /> ruku=ruku[1].value;//What’s wrong with this sentence<br /> ruku=divs[i].parentNode.nextSibling.childNodes[1];//What is the error in this sentence? <br /> </script>
ruku=ruku[1].value should be [0]
Sorry, firstChild is labeled 0, not 1
ruku=ruku[0].value is correct