Today's Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a couple of input text boxes on it. How do I make the
input boxes have a default value of today's date?

Thanks.
 
You can use ASP or JavaScript to do this. Ex:

<html>
<head>
<title>My Page</title>
<script>
function shortDate() {
oDate = new Date();
month = oDate.getMonth();
year = oDate.getFullYear();
day = oDate.getDate();
return month + 1 + '/' + day + '/' + year; }
</script>

</head>
<body onload="document.theform.thefield.value = shortDate();" >
<form name="theform">
<input type="text" name="thefield" value="">
</form>

</body>

</html>
 
Back
Top