A custom function that loops through the text content of elements
This function can ensure that it works well in HTML and XML DOM documents. Using this function, you can get the text content of any element
Loops through the text content of elements
A function that loops through the text content of the element
Usually, we use previousSibling, nextSibling, firstChild , lastChild and so on to traverse the DOM document, however, text nodes are often traversed. Under normal circumstances, we do not need to traverse text nodes. So, here, we can use several custom functions to encapsulate previousSibling, nextSibling, firstChild, and lastChild, skip the traversed text nodes, and directly obtain the element node
Several alternative functions for finding nodes
< title>Alternate functions for previousSibling, nextSibling, firstChild, lastChild and parentNode
Most WEB developers only need to traverse DOM elements rather than adjacent text in most cases Node
So, we can define several functions ourselves to replace previousSibling, nextSibling, firstChild, lastChild and parentNode
7 ways to get form objects
Multiple ways to get form objects
7 ways to get form objects
Use javascript to implement the functions of selecting all, inverting the selection, and deselecting none
< ;title>Select all, invert selection, unselect all
Select all All Uncheck Invert Move the mouse up to display the sub-column list
显示隐藏菜单
操作菜单
通过for...in循环语句,可以遍历出某个对象中的属性
比如,我们想要看下document对象中的所有属性名和属性值,可以使用如下所示的代码:
View Code
遍历document文档对象的所有属性
同理,我们也可以用以上方法遍历window对象,location对象,history对象等的属性,当然,也可以用来遍历自定义对象的属性