Javascript examples for DOM HTML Element:Input Button
exact time upon button click
<html> <head> <title>Button Click</title> <script type="text/javascript"> function filter_seconds(date){ return date.replace(/(\d{1,2}\:\d{1,2})\:\d{2}/, '$1') }//ww w . ja v a2 s.c om </script> </head> <body> <input type="text" id="date" value=""> <input id="button" type="button" value="Get the Date!" onclick="document.getElementById('date').value = filter_seconds(new Date().toLocaleTimeString(navigator.language))"> </body> </html>