Javascript examples for DOM HTML Element:Form Event
Set input from <input> tag
<html> <head> <script> function myFunction()/* ww w.ja v a 2 s.c o m*/ { var a = document.getElementById("txt_1").value; document.getElementById("demo").innerHTML = a; } </script> </head> <body> <form> <input type="text" id="txt_1" name="txt_1"> <input type="button" onclick="myFunction()" value="Click me"> </form> <p id="demo"></p> </body> </html>