Anchor host attribute
Definition and usage
host
Property setting or return href attribute value Hostname and port part。
Note:If the port number is not specified in the URL (or if it is the default port of the protocol - for example 80 or 443), some browsers will not display the port number.
See also:
JavaScript Reference Manual:location.host attribute
Example
Example 1
return hostname and port number of the link:
var x = document.getElementById("myAnchor").host;
Example 2
Change the hostname and port number of a link:
document.getElementById("myAnchor").host = "www.somenewexamplepage.com:344";
Example 3
Another example of how to change the hostname and port number of a link:
document.getElementById("myAnchor").host = "www.codew3c.com:80";
Syntax
return host attribute:
anchorObject.host
set host attribute:
anchorObject.host = hostname:port
ਵਿਸ਼ੇਸ਼ਤਾ ਮੁੱਲ
ਮੁੱਲ | ਵਰਣਨ |
---|---|
hostname:port | ਯੂਆਰਐੱਲ ਦੇ ਮਾਲਕ ਨਾਮ ਅਤੇ ਪੋਰਟ ਨੰਬਰ ਨੂੰ ਨਿਰਧਾਰਿਤ ਕਰਦਾ ਹੈ。 |
ਤਕਨੀਕੀ ਵੇਰਵੇ
ਵਾਪਸ ਮੁੱਲ: | ਸਟ੍ਰਿੰਗ ਮੁੱਲ, ਯੂਆਰਐੱਲ ਦੇ ਨਾਮ (ਜਾਂ IP ਠਿਕਾਣਾ) ਅਤੇ ਪੋਰਟ ਨੰਬਰ ਦੇ ਪ੍ਰਤੀਕਰਮ |
---|
ਬਰਾਉਜ਼ਰ ਸਮਰਥਨ
ਚਰਮ | ਐਂਜਲ | ਫਾਇਰਫਾਕਸ | ਸੈਫਾਰੀ | ਓਪੇਰਾ |
---|---|---|---|---|
ਚਰਮ | ਐਂਜਲ | ਫਾਇਰਫਾਕਸ | ਸੈਫਾਰੀ | ਓਪੇਰਾ |
ਸਮਰਥਨ | ਸਮਰਥਨ | ਸਮਰਥਨ | ਸਮਰਥਨ | ਸਮਰਥਨ |