HTMLMapElement:name 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
HTMLMapElement
的 name
属性表示 <map>
元素的唯一名称。它的值可以与 <img>
元素的 useMap
属性一起使用,以引用 <map>
元素。
如果 <map>
元素设置了 id
属性,则 name
属性应该与其 id
属性相同。
值
一个没有空格的非空字符串。
示例
html
<map name="image-map">
<area shape="circle" coords="15,15,5" />
</map>
js
const mapElement = document.getElementsByName("image-map")[0];
console.log(mapElement.name); // 输出:“image-map”
规范
Specification |
---|
HTML # dom-map-name |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.