Javascript examples for DOM HTML Element:Input Text
Auto update textfield with DateTime on button Click
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function display() { var date = new Date();//from ww w . j a va2 s. com document.getElementById("textField1").value = date.toString(); } </script> </head> <body> <form id="form1" action="http://java2s.com"> <input id="textField1" type="text" align="right" size="13"> <br> <input id="button1" type="button" value="Date Time" onclick="display()"> </form> </body> </html>