In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, Xiaobian will bring you about how to identify and control the page elements in DHTML and JS. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.
Do you know how to control each page element? Here is a brief introduction to the identification control of page elements in DHTML and JS. I believe you will be interested.
Recognition control of page elements in DHTML and JS
In the process of making dynamic web pages, we often need to perform corresponding operations on the corresponding page elements, which requires us to be able to accurately control each page element.
Generally, elements in web pages can be identified in many ways, such as by context recognition, trigger element recognition, and so on.
The three most common ways to identify elements in web pages are ID, CLASS, and NAME, which identify individual elements, CLASS is used to name the same type, and NAME is used to name general elements.
For example, it can be named as follows:
When we call these elements in JAVARIPT, we can identify them with document.all.pic, document.all.kuai.
In general, a name is only used for the naming of an element, but it is not exactly the case. Sometimes elements of the same type need the same effect, not only can they be identified by CLASS, but also by ID or NAME. When referring, they can operate on all the same ID and NAME together.
But this raises the question of how to identify one of these elements.
The difference between this identification and single-name identification is that a numerical index is added, such as the previous pic can also be identified by document.all.pic [1], and the others are identified by the corresponding number according to the order in which they appear on the page.
In many cases, the control function is triggered by the corresponding event, so we may use the element that triggered the event. In this case, eventElement can be used to identify which element it represents that triggered the event.
ParentElement and childrenElement can also be used to identify parent and child elements of trigger event elements.
When we get a trigger element with eventElement, we can also get its identity name. For example, eventElement.tagName gets the HTML ID name of the element, eventElement.id gets the name of the element, eventElement.name gets the name of the element.
The above is how to identify and control the page elements in DHTML and JS shared by Xiaobian. If you happen to have similar doubts, you may wish to refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.