Skip to content Skip to sidebar Skip to footer

JAVASCRIPT-FORM

User must be able to insert name,address,gender,stream and module....when user clicks the clear button,the form should be cleared, and when user clicks the Ok Button,the name and a

Solution 1:

Try this, It will display two fields in display area,In order to use reset function use type=reset in form input it will reset form fields

<input type="reset" value="Reset form" />

Script

function clickOk(){

  if(document.getElementById("txtName").value!=" "){

              if(document.getElementById("txtAdd").value!=" "){

                   var nam=document.getElementById("txtName").value;
                   var add=document.getElementById("txtAdd").value;

              document.getElementById("display").innerHTML='<hr>Hi ' 
             +nam+'<br>Address: '+add;
                        }

              else 
                   alert("Please enter your Address");
              }

else 
         alert("Please enter your Name");
}

Fiddle


Post a Comment for "JAVASCRIPT-FORM"