Click to See Complete Forum and Search --> : initial input value=today (I hope)


moreta
08-26-2004, 11:21 AM
I'd like to set the initial value for <input type="text"> to today's date. I've been doing this server-side (when the page is generated), but it would be helpful to do it on the fly.

The JS function that generates today's date is working correctly, but not with value. The syntax that works with events isn't working with value. I've tried every variation that I can think of <input name="test" type="text" value=????>. Am I completely off the mark on this?

Thank you,
Moreta

Willy Duitt
08-26-2004, 11:45 AM
You could try passing the date on body onload...

<body onload="document.forms[0].test.value=new Date()">
<form><input name="test" type="text" value=""></form>


.....Willy

Edit: I did not realize that your question was already answered here (http://www.webdeveloper.com/forum/showthread.php?s=&threadid=42856)....

moreta
08-26-2004, 12:04 PM
I didn't realize it was in there twice! Not sure how I did that, as I didn't intend to double-post. :confused: