JavaScript Reference/Javascript Collections/attributes

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

"attributes" 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>
   
  


"attributes" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> <applet> | | |<area> | | |<base> <basefont> | | | <bgsound> |

| |
|

| |<body>
| | |<button> |

| |
|

| | <col> | | |<colgroup> <comment> | | |

| | | <dir> |

| |
|

| |

| | |<embed> <fieldset> | | | <form> | | |<frame> <frameset> | | |<head> <hn> |

| |
<html> |

| | <iframe> | | |<img> <input type="button"> | | |<input type="checkbox"> <input type="file"> | | |<input type="hidden"> <input type="image"> | | |<input type="password"> <input type="radio"> | | |<input type="reset"> <input type="submit"> | | |<input type="text"> | | |<isindex> | | |<label> <legend> |

| |
  • <link> | | |<listing> <map> | | |<marquee> <menu> | | |<meta> <noframes> | | |<noscript> <object> | | |
      <optgroup> | | |<option>

      | | |<param>

                               |
      |                |                                                        |
      |                |                          <script>                      |
      |                |<select>                                               |
      |                |                                                |
      |                |                        <style>                       |
      |                |                                                    |
      |                |                         <tbody>                       |
      |                |                          |
      |                |                             
        | | | <xmp> | +----------------+--------------------------------------------------------------+ </source>

        "attributes" JavaScript properties and JavaScript methods

        <source lang="javascript"> JavaScript properties and JavaScript methods

        item(), length, getNamedItem(), removeNamedItem(), setNamedItem()


        </source>



        "attributes" Syntax Parameters and Note

        <source lang="javascript"> Note: Returns an array of all specified and unspecified attributes of an element.

        Syntax:

        document.getElementById("elementID").attributes // returns all attributes document.getElementById("elementID").attributes(param1) // returns an individual attribute document.all.elementID.attributes // IE only document.all.elementID.attributes(param1) // IE only

        param1 Required; the zero-based index


        </source>

      <textarea> | | |<tfoot> |

      | |<thead> <title> |

      | |