JavaScript Reference/Javascript Methods/getAttributeNode

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

"getAttributeNode()" Example

   <source lang="javascript">
   

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

   var m = document.getElementById("myDiv").getAttributeNode("id");
   var n = m.value;
   alert(n); 

} </script>

This is a div element

<input type="button" value="Get id attribute node value" onclick="function1();"> </body> </html>


     </source>
   
  


"getAttributeNode()" is applied to

   <source lang="javascript">

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

| |
|

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

| |
|

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

| | | |

| |<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> | | |<nobr> <noframes> | | |<noscript> <object> | | |
      <optgroup> | | |<option>

      | | |<param> <plaintext> | | |

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

        "getAttributeNode()" Syntax, Parameters and Note

        <source lang="javascript"> Note: Returns the attribute object belonging to the specified element.

        Syntax:

        document.getElementById("elementID").getAttributeNode(param1) document.all.elementID.getAttributeNode(param1) // IE only Parameters: param1 Required; the name of the attribute.


        </source>

      <textarea> | | |<tfoot> |

      | |<thead> <title> |

      | |