当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > DOM Anchor
The Anchor object represents an HTML hyperlink. For each instance of an HTML <a> tag in a document, an Anchor object is created.
锚对象代表一个HTML超级链接。HTML文档中有<a>标签,一个锚对象就随之建立了
An anchor can be used to create a link to another document (with the href attribute) or to create a bookmark inside a document (with the name attribute).
锚对象可以被用来建立一条到另一文档的连接(通过href属性)或在文档内建立一个书签(用name属性)
You can access an Anchor object by indexing the anchors' array (by number or name) of the Document object or by using getElementById().
你可以通过Document对象或使用getElementById()索引锚的数组(用name的数字)来访问一个锚对象
IE: Internet Explorer, F: Firefox火狐, N: Netscape网景, W3C: World Wide Web Consortium (Internet Standard).
Property属性 | Description描述 | IE | F | O | W3C |
---|---|---|---|---|---|
accessKey | Sets or returns a keyboard key to access a link 设置或返回可访问链接的按键 | 5 | 1 | No | Yes |
charset | Sets or returns the character-set of the linked resource 设置或返回所链接资源的字符集 | 6 | 1 | 9 | Yes |
coords | Sets or returns a comma-separated list with coordinates of a link in an image-map 设置或返回用逗号分割的列表里面有热点图链接 | 6 | 1 | 9 | Yes |
href | Sets or returns the URL of the linked resource 设置或返回所链资源的URL | 5 | 1 | 9 | Yes |
hreflang | Sets or returns the language code of the linked resource 设置或返回所链资源的语言代码 | 6 | 1 | 9 | Yes |
id | Sets or returns the id of a link 设置或返回链接的id | 4 | 1 | 9 | Yes |
innerHTML | Sets or returns the text of a link 设置或返回链接的文字 | 4 | 1 | 9 | No |
name | Sets or returns the name of a link 设置或返回链接的name | 4 | 1 | 9 | Yes |
rel | Sets or returns the relationship between the current document and the target URL 设置或返回当前文当个目标URL之间的关联 | 5 | 1 | No | Yes |
rev | Sets or returns the relationship between the target URL and the current document 设置或返回目标URL和当前文档之间的关联 | 5 | 1 | No | Yes |
shape | Sets or returns the shape of a link in an image-map 设置或返回在热点图中链接的形状 | 6 | 1 | 9 | Yes |
tabIndex | Sets or returns the tab order for a link 设置或返回链接的tab顺序 | 6 | 1 | 9 | Yes |
target | Sets or returns where to open a link 设置或返回打开链接的方式 | 5 | 1 | 9 | Yes |
type | Sets or returns the MIME type of the linked resource 设置或返回所链资源的MIME类型 | 6 | 1 | 9 | Yes |
Property 属性 | Description 描述 | IE | F | O | W3C |
---|---|---|---|---|---|
className | Sets or returns the class attribute of an element 设置或返回元素的class属性 | 5 | 1 | 9 | Yes |
dir | Sets or returns the direction of text 设置或返回文字的方向 | 5 | 1 | 9 | Yes |
lang | Sets or returns the language code for an element 设置或返回某一元素的语言代码 | 5 | 1 | 9 | Yes |
title | Sets or returns an element's advisory title 设置或返回某元素的咨询标题 | 5 | 1 | 9 | Yes |
Method 方法 | Description 描述 | IE | F | O | W3C |
---|---|---|---|---|---|
blur() | Removes focus from the link 取消对某连接的聚焦 | 5 | 1 | 9 | Yes |
focus() | Gives focus to the link 让某连接获得聚焦 | 5 | 1 | 9 | Yes |