var x = document.getElementById("myDIV"); x.getElementsByTagName("P")[1].style.backgroundColor = "red";