Get element by name : Document : Development JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Development » Document »

 

Get element by name



<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>



           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Development
» Document