enuenu
10-13-2007, 10:22 AM
Can anyone tell me why the code below does not work. When the user clicks anywhere on the form the current date is supposed to be displayed in the input box. It does not work and I cannot work out why.
<html>
<title>Date form</title>
<script type="text/javascript" language="JavaScript">
/*function to get today's date */
function today(){var theDate = new Date();
return theDate;}
/*function to get date to load on form click */
function start(){document.getElementById.('formdate').value=today();}
</script>
</head>
<body>
<form name="date" onclick="start()">
Date: <input id="formdate" name="formdate" size="50" />
</form>
</body>
</html>
<html>
<title>Date form</title>
<script type="text/javascript" language="JavaScript">
/*function to get today's date */
function today(){var theDate = new Date();
return theDate;}
/*function to get date to load on form click */
function start(){document.getElementById.('formdate').value=today();}
</script>
</head>
<body>
<form name="date" onclick="start()">
Date: <input id="formdate" name="formdate" size="50" />
</form>
</body>
</html>