JavaScript Reference/Javascript Methods/getElementsByName

Материал из Web эксперт
Версия от 11:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"getElementsByName()" Example

   <source lang="javascript">
   

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

  var m = document.getElementsByName("myE");
  alert(m.length); 

} </script> <a id="myE"

  href="http://www.wbex.ru" 
  onclick="return(false);">

This is a link </a>

This is a div element

This is a p element

<input type="button"

      value="Get the number of elements that have the same name" 
      onClick="function1();">

This is a table element

</body> </html>


     </source>
   
  


"getElementsByName()" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |document | +----------------+--------------------------------------------------------------+

     </source>
   
  


"getElementsByName()" Syntax, Parameters and Note

   <source lang="javascript">

Note: Get element by name.

Syntax:

document.getElementsByName(param1) Parameters:

   param1   Required; the element"s name or id attribute value.
   
     
     </source>