Why can't the following code change "Hello" in the p tag to "Hello everyone"?
getElementsByTagName The function returns a DOM collection:
getElementsByTagName
cont[0].innerHTML = 'Hello'
getElementById returns a value, while getElementsByName returns a collection. id is unique, name can be the same.
getElementsByTagName
The function returns a DOM collection:getElementById returns a value, while getElementsByName returns a collection.
id is unique, name can be the same.