Button to display the names of all the elements in a form : Button : Form Control JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Form Control » Button »

 

Button to display the names of all the elements in a form





<html>
<head>
<script type="text/javascript">
function showFormElements(theForm){
    str="Form Elements: "
    for (i=0; i<theForm.length; i++)
        str+=" n " + theForm.elements[i].name
        alert(str)
    }
</script>
</head>

<body>
<form>
    First name: <input type="text" name="fname" size="20">
    <br>
    Last name: <input type="text" name="lname" size="20">
    <br>
    <br>
    <input type="button" name="button1" value="Display name of form elements"
            onClick="showFormElements(this.form)">
</form>
</body>

</html>



           
       



-

Leave a Comment / Note


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

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Form Control
» Button