Date: <br />
<input type="text" name="date" style="width:300px;" class="inputbox" value="document.write(new Date().toLocaleString());" validate="blank"<br />
Date: <br />
<input type="text" name="date" style="width:300px;" class="inputbox" value="document.write(new Date().toLocaleString());" validate="blank"<br />
Hi:
When embedding JavaScript within HTML you always need the <script> tags. So it might look something like:
Code:Date: <br /> <input type="text" name="date" style="width:300px;" class="inputbox" value="<script type="text/javascript">document.write(new Date().toLocaleString())</script>" validate="blank"><br />
Uhng. Never work, DD. Looks like you've been doing too much server-side coding lately. You will have better luck with this:
If the input were part of a form, there are better ways to do it and, even without a form, it could be more robust. But, the above will work in most (perhaps all) modern browsers.HTML Code:Date: <br> <input type="text" id="date_put" name="date" style="width:300px;" class="inputbox" value="" validate="blank"> <script type="text/javascript">document.getElementById('date_put').value=new Date().toLocaleDateString();</script> <br>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Lol what's even scarier is that it just took me a few minutes to even see why my code wouldn't work. I don't think it's that I've been doing too much server side coding lately. More like lack of coding.
I mentioned server side code because that is sort of how one might do something like that in PHP or asp. Glad you got a chuckle out of it.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks