JavaScript Reference/Javascript Properties/host

Материал из Web эксперт
Перейти к: навигация, поиск

"host" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript">

   function function1() {
       alert(document.getElementById("myLink").host);
   }

</script> <a id="myLink" href="http://www.wbex.ru" target="_blank">wbex.ru Home Page</a> <button onclick="function1();">Host Value</button> <button onclick="alert(document.all.myLink.hostname);">Host Name</button> </body> </html>


     </source>
   
  


"host" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <area> | | |location | +----------------+--------------------------------------------------------------+

     </source>
   
  


"host" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Specifies the URL domain name and port number.

Syntax:

document.getElementById("elementID").host = value document.all.elementID.host = value // IE only location.host = value


     </source>