您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

H5的通用接口详细介绍

2026/2/1 2:04:53发布15次查看
这次给大家带来h5的通用接口详细介绍,怎样使用h5的通用接口?h5的通用接口的注意事项有哪些,下面就是实战案例,一起来看一下。
先说几个基本类型: domstring, boolean, long, unsigned long, double,
nan(not-a-number)。
domstring其实就是其它大家常用的语言中的string。 在html5中,它用于表示url,dom内容等等。其他的boolean(布尔), long(长整型), unsigned long(无符号长整型), double(浮点数)我想不用我详述,大家都能清楚。至于nan我想大部分js老鸟也都清楚其意义,就是在一个无穷大
或者非数字的值。
官方文档里没有介绍undefined和null,至于为什么,希望能有高手给予解答~~
2. 集合类型包括: htmlcollection, htmlallcollection,
htmlformcontrolscollection, htmloptionscollection, and
htmlpropertiescollection。
htmlcollection是一个泛型集合,也是一个集合的基础接口,它提供了三个attributes:
length, item, nameditem.
length是集合的长度。
item(index)可以用索引值获取集合中的元素。
nameditem(name)可以用元素的name获取元素。
实际上你也可以直接用collection[index],collection(index)或collection
[name],collection(name)获取集合中的元素。
htmlallcollection继承自htmlcollection接口,他包含以下属性:
length和item属性跟htmlcollection的一样。
nameditem(name)区别于htmlcollection的是它有可能返回的是一个集合。
tags(tagname)用tagname返回一个集合。
同样你也可以直接用collection[index],collection(index)或collection
[name],collection(name)获取集合中的元素,当那么值匹配多个元素时返回一个
htmlallcollection。
htmlformcontrolscollection是一个以form和fieldset为元素的集合。同样继承自
htmlcollection接口。
有htmlcollection的所有属性,并另外增加了radionodelist接口。它继承自nodelist。
其实radionodelist按定义上来说就是一个radiobutton的集合。我比较好奇这样一个list放
在htmlformcontrolscollection里的用意。
htmloptionscollection是一个option的集合,继承自htmlcollection接口,它一般用
于操纵select标签的子元素。
htmloptionscollection特有的属性有:add(option),remove(index),selectedindex
add方法有两个重载
void add(in htmlelement element, in optional htmlelement before);
void add(in htmlelement element, in long before);
增加一个元素第一参数必须,后面的参数是可选的
remove(index)以索引删除一个元素。
selectedindex相信大家都能明白。
相信看了这些案例你已经掌握了方法,更多精彩请关注其它相关文章!
相关阅读:
bootstrap里如何统计table sum的数量
怎么用js做出切换隐藏与显示同时切换图标
vue.js todolist如何实现
以上就是h5的通用接口详细介绍的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product