JavaScript Reference/Javascript Properties/protocol

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

"protocol" Example

   <source lang="javascript">
   

<html> <body> <script language="JavaScript"> function function1() {

  alert(document.getElementById("myA").protocol);

} </script> <a id="myA" href="http://www.wbex.ru" target="_blank">wbex.ru home page</a> <input type="Button" id="myB" value="Protocol" onClick="function1();"> </body> </html>


     </source>
   
  


"protocol" is applied to

   <source lang="javascript">

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

     </source>
   
  


"protocol" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Sets the URL protocol part.

Syntax:

document.getElementById("elementID").protocol = value document.all.elementID.protocol = value // IE only objectName.protocol


     </source>