📄 17-10.js
字号:
// Define a NodeFilter function to accept only <img> elementsfunction imgfilter(n) { if (n.tagName == 'IMG') return NodeFilter.FILTER_ACCEPT; else return NodeFilter.FILTER_SKIP;}// Create a NodeIterator to find <img> tagsvar images = document.createNodeIterator(document, // traverse entire document /* only look at Element nodes */ NodeFilter.SHOW_ELEMENT, /* filter out all but <img> */ imgfilter, /* unused in HTML documents */ false);// Use the iterator to loop through all images and do something with themvar image;while((image = images.nextNode()) != null) { image.style.visibility = "hidden"; // Process the image here}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -