function myChoc() { var x = document.getElementsByTagName("P").namedItem("chocolate"); alert(x.innerHTML); }