(三)类数组对象 NamedNodeMap简单介绍
2024-10-12 07:31:17
Ele.attrbutes将返回一个NamedNodeMap对象,即NamedNodeMap存储的是元素的“特性Attribute”集合。而集合中的每一个元素,都是Attr类型的对象。
html:
<ul id="box" data-url="index.html" node-action="submit">
<li>节点一</li>
<li>节点二</li>
<li>节点三</li>
</ul>
JS:
var box = document.getElementById("box");
var attrs = box.attributes;
console.log(attrs);
console.log(attrs.length);
console.log(attrs[0]);
console.log(attrs.item(1));
结果如下:
最新文章
- 【转】超实用的JavaScript技巧及最佳实践
- 如何清除swap里的文件
- editplus bat语法高亮
- URL是什么?
- Windows下OpenCV的环境配置
- 4.关于phpstudy for linux 的安装(LNMP)更好的环境请看8.LNMP环境
- 全文索引--自定义chinese_lexer词典
- Java学习笔记(1)——基本数据类型
- Mac 安装Qt5.1编译出现的错误解决
- Android开发技巧——PagerAdapter再简单的包
- Sublime Text3 使用手册
- Oracle通过SCN做增量备份修复DG
- 剑指offer(13)
- The missing package manager for macOS (or Linux)
- iOS 弹幕制作
- 18.4 #if 0…endif的用途
- what&#39;s the 单例模式
- HDU 3970 Harmonious Set 容斥欧拉函数
- 文件读取ndarry 等价于DataFrame的操作
- ubuntu16更新源
热门文章
- A - Packets 贪心
- windows通过node环境搭建安装npm,cnpm,vue-cli
- 修改CentOS默认yum源为国内yum镜像源
- 【适合核显电脑的环境配置】Tensorflow教程-Windows 10下安装tensorflow CPU with Anaconda
- 【转】Windows中设置Fiddler抓HTTPS请求的解决办法 Unable to configure Windows to Trust the Fiddler Root certificate .
- 【vue】vue +element prop用法
- ESP8266烧录配置
- 在flask中使用swagger(flasgger使用方法及效果展示)
- Spring MVC 5 + Thymeleaf 基于Java配置和注解配置
- python 获取gearbest地址库代码