<html>
<head>
<script type="text/javascript">
function getElements(){
var x=document.getElementsByName("myInput")
alert(x.length + " elements!")
}
</script>
</head>
<body>
<form >
<input name="myInput" type="text" size="20"><br>
<input name="myInput" type="text" size="20"><br>
<input name="myInput" type="text" size="20"><br>
<br>
<input name="mybutton" type="button" onclick="getElements()"
value="Show how many elements named 'myInput'">
</form>
</body>
</html>
|