JavaScript Reference/Javascript Methods/getElementsByName — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
"getElementsByName()" Example
<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>
<div id="myE">This is a div element</div>
<p id="myE" style="cursor:hand">This is a p element</p>
<input type="button"
value="Get the number of elements that have the same name"
onClick="function1();">
<table id="myE" style="cursor:hand">
<tr><td>
This is a table element
</td></tr>
</table>
</body>
</html>
"getElementsByName()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |document |
+----------------+--------------------------------------------------------------+
"getElementsByName()" Syntax, Parameters and Note
Note:
Get element by name.
Syntax:
document.getElementsByName(param1)
Parameters:
param1 Required; the element"s name or id attribute value.