Javascript examples for DOM HTML Element:Input Hidden
insert result of Javascript function into form hidden field
<html> <head></head> <body onload="getHours()"> <form method="post" action="http://example.com/some.php"> <input type="hidden" name="clientid" id="clientid" value="test" action="javascript:getHours()"> </form> <script> function getHours() {//from w ww . ja v a2 s .c om var d = new Date(); var h = d.getHours(); var m = d.getMinutes(); document.getElementById('clientid').value = h + " " + m; } </script> </body> </html>