Article From:

Click on the picture, add a style (add a class name to him), and then click OK. Is it OK to get the SRC under this class name with JS? But why am I undefined?

Answer 0:

Because document.getElementsByClassName returns an array of objects, if your web page has only one picture of class user_photo_bord, you should write this:


Both getElementsByName and getElementsByTagName are returned to an element array, because in DOM, className, name, or label names may not be unique, onlyGetElementById will return to a specific element. If we observe carefully, we can find that the former is getElements and the latter is getElement, which is the difference.

Answer 1:

The way to get the element returns an array, first using the subscript.

Answer 2:


Answer 3:

The third floor of the two floor is written right!

Leave a Reply

Your email address will not be published. Required fields are marked *