Thanks much for the suggestion Michael.
It does not seem to paste the date into the field though. Let meknow please if
I am missing something in my coding below:
<script type="text/javascript">
function show_now() {
var my_time = new Date();
document.myForm.myDate.value = my_time;
}
</script>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"
alink="#ff0000">
<form name="myform">
<input name="mydate" type="text" size="10" />
<input type=button value="Show Time" onclick="show_now();">
</form>
-----Original Message-----
From: "Michael Grant" <[email protected]>
Sent: Monday, January 3, 2011 3:29pm
To: "cf-talk" <[email protected]>
Subject: Re: SOT: Show time in field on click
say you have a field named "myDate" in a form named "myForm" then instead
of:
alert(my_time);
put:
document.myForm.myDate.value = my_time;
On Mon, Jan 3, 2011 at 3:25 PM, Orlini, Robert <[email protected]> wrote:
>
> Hi,
>
> I have this code I gleaned that will show the time as a popup when clicked.
> I was wondering how I can have it enter the time into an input field of a
> form as opposed to being a popup?
>
> Thanks.
>
> RO
> HWW
>
>
> <html>
> <head>
> <title>(Type a title for your page here)</title>
> <script type="text/javascript">
> function show_now() {
> var my_time = new Date();
> alert(my_time);
> }
> </script>
> </head>
>
>
> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080"
> alink="#ff0000">
>
> <input type=button value="Show Time" onclick="show_now();">
>
> </body>
> </html>
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340367
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm