That's because the correct function name is getElementsByTagName
and not getElementByTagName
.
var items = document.getElementsByTagName("li");
This will return a Nodelist of elements with that particular tag name (in this case, all list items in the document).
Then, you could target your li's specifically as you wish, for example:
items[0].style.color = "yellow"; // first li is yellow when mouseover
items[1].style.color = "red"; // second li is red when mouseover
etc.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…