开发者

reference for attributes of <a> tag

开发者 https://www.devze.com 2023-03-31 15:58 出处:网络
I found this mdn document for the a tag but it does not list the hostname attribute.Where can I get info. on this?This is an attribute/property of the anchor object correct?And why the hell is this th

I found this mdn document for the a tag but it does not list the hostname attribute. Where can I get info. on this? This is an attribute/property of the anchor object correct? And why the hell is this thing called an anchor instead of a link? That's what it is..a hyperlink. Getting frustated with finding documenta开发者_开发问答tion...maybe I just overlooked it...actually I ran a search for hostname and no go.

Basically if I have

  b=document.createElement('a')
  b.href=c[2].value;

I can access

b.hostname

but I need documention for this property.


mdn is not the standard, which does mention the hostname attribute.

An <a> element is usually a link (i.e. its href property is set). However, you can also use it as an anchor, as in:

<a href="#bottom">Bottom</a>
<a name="bottom">This is an anchor</a>

This functionality is obsolete; you can now set the id attribute of any element instead:

<a href="#bottom">Bottom</a>
<div id="bottom">This is an anchor</div>


It's a property of the Location object.

As about the name of the <a> (anchor) tag, I'm not an English native speak but a link has two ends and it seems that anchor refers to any of them:

http://www.w3.org/TR/1998/REC-html40-19980424/struct/links.html

There's only one tag to define both ends and that's the name they chose.

0

精彩评论

暂无评论...
验证码 换一张
取 消