JavaScript Reference/Javascript Properties/nodeName

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

"nodeName" Example

   <source lang="javascript">
   

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

  alert(document.all.myNodeOne.nodeName);

} </script>

This PARAGRAPH has two nodes, Node One, and Node Two.

<button onclick="function2();">Node One Name</button> </body> </html>


     </source>
   
  


"nodeName" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |<a> <acronym> | | |<address> <applet> | | |<area> attribute | | | <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> | | |<plaintext>

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

        "nodeName" Possible Values

        <source lang="javascript"> Possible Values The tag name for a regular node, the attribute name for an attribute node,

        1. text for the text content of an element (text node).


        </source>



        "nodeName" Syntax and Note

        <source lang="javascript"> Note: Read-only property. Returns the node name.

        Syntax:

        document.getElementById("elementID").nodeName document.all.elementID.nodeName // IE only


        </source>

      <textarea> |

      | |TextNode <tfoot> |

      | |
      <thead> | | |<title>