Apr 22, 2003 #1 Giblets Programmer Feb 19, 2003 6 GB Hello,I have the following question; How would I write a function to allow me to insert the current date into a date field on a form? I don't have much javascript experience so I'ld be really grateful for some help. Cheers Giblets.
Hello,I have the following question; How would I write a function to allow me to insert the current date into a date field on a form? I don't have much javascript experience so I'ld be really grateful for some help. Cheers Giblets.
Apr 22, 2003 #2 chmohan Programmer Apr 9, 2003 392 US just use this var datefield=new Date()-it automatically puts todays date into the variable datefield if you wnat to see the date if you have a textbox textbox1.text = datefield.Date will show you the date as of now Upvote 0 Downvote
just use this var datefield=new Date()-it automatically puts todays date into the variable datefield if you wnat to see the date if you have a textbox textbox1.text = datefield.Date will show you the date as of now
Apr 22, 2003 #3 dougcranston Technical User Oct 5, 2001 326 US Giblets, Here is one way to accomplish your request.. This is done clientside. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Page title</title> </head> <body> <script language="javascript"> <!-- var dateit = new Date(); document.write("<input type=text name='todaysDate' value='" + dateit + " style='font-size:11px'>" //--> </script> </body> </html> Hope this helps. DougCranston Upvote 0 Downvote
Giblets, Here is one way to accomplish your request.. This is done clientside. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Page title</title> </head> <body> <script language="javascript"> <!-- var dateit = new Date(); document.write("<input type=text name='todaysDate' value='" + dateit + " style='font-size:11px'>" //--> </script> </body> </html> Hope this helps. DougCranston