JavaScript Reference/Javascript Objects/attribute

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

"attribute" Example

   <source lang="javascript">
   

<html> <body> <input type="button"

      value="Get the value of this button" 
      onclick="alert(this.attributes("value").value);">

</body> </html>


     </source>
   
  


"attribute" is applied to

   <source lang="javascript">

Names noted with an asterisk (*) are JavaScript properties only. +----------------+--------------------------------------------------------------+ | Applied_To |attributes* | +----------------+--------------------------------------------------------------+

     </source>
   
  


"attribute" JavaScript collections

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | JavaScript |childNodes | | collections | | +----------------+--------------------------------------------------------------+

     </source>
   
  


"attribute" JavaScript Methods

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | JavaScript |appendChild cloneNode | | Methods |hasChildNodes insertBefore | | |removeChild replaceChild | +----------------+--------------------------------------------------------------+

     </source>
   
  


"attribute" JavaScript Properties

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | JavaScript |expando firstChild | | Properties |lastChild name | | |nextSibling nodeName | | |nodeType nodeValue | | |ownerDocument parentNode | | |previousSibling specified | | |value | +----------------+--------------------------------------------------------------+

     </source>
   
  


"attribute" Syntax and Note

   <source lang="javascript">

Note: An attribute of an element. You can only access the attribute object by referencing the desired index in the attributes collection.

Syntax:

document.all.elementID.attributes(index).memberName


     </source>