G Guest Oct 15, 2005 #1 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.
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.
D David Berry Oct 15, 2005 #2 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>
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>