<form name = "form1"> <input type = "text" name = "name"><br> <input type = "submit" onclick="return handler();"> </form> <script> function handler(){ var text = document.form1.name.value; alert(text); return false; } </script>