Categories: DOM对象tips

HTML DOM embeds 属性 | HTML DOM Document 对象

返回到:DOM 对象:HTML DOM Document 对象

定义与用法

embeds 返回文档中所有 <embeds> 元素的集合。

注意: 元素在集合中的顺序是它们在源代码中的顺序。

浏览器支持:

主流浏览器都支持

语法

document.embeds

属性

属性描述
length返回集合中 <embed> 元素的数量。

注意: 该属性是只读的。

方法

方法描述
[index]返回集合中指定索引(从 0 开始)对应的 <embed> 元素 。

注意: 如果索引值超出范围,返回 null。
item(index)返回集合中指定索引(从 0 开始)对应的 <embed> 元素 。

注意: 如果索引值超出范围,返回 null。
namedItem(id)返回集合中指定索引对应的 <embed> 元素。

注意: 如果 id 不存在,则返回 null。

技术细节

DOM 版本:Core Level 3 Document Object
返回值:HTMLCollection 对象,表示文档中所有的 <embed> 元素。元素在集合中的排序是其在源代码中的排序。

实例

计算文档中有多少个 <embed> 元素:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web176教程网(web176.com)</title>
</head>
<body>

<embed src="helloworld.swf">
<embed src="helloworld.swf">

<p>点击按钮显示文档中 embed 元素中的数量。</p>

<button >

terry

这个人很懒,什么都没有留下~

Share
Published by
terry

Recent Posts