w3pop.com :: ÍøÂçѧԺ :: 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 È¡Ïû¶ÔijÁ¬½ÓµÄ¾Û½¹ |
5 | 1 | 9 | Yes |
| focus() | Gives focus to the link ÈÃijÁ¬½Ó»ñµÃ¾Û½¹ |
5 | 1 | 9 | Yes |
ÆÀÂÛ (0)
All