Hi, newbie to Javascript here... I am trying to insert the "time" at the moment the button is clicked into an existing form field. I thought it would be simple but I am just not getting it. I have tried numerous ways but none are working..
Here is where I am at the moment:
Any help would be greatly appreciated... Thanks
Dave
Here is where I am at the moment:
Code:
<script type="text/javascript">
function startTime()
{
var today=new Date()
var h=today.getHours()
var m=today.getMinutes()
var s=today.getSeconds()
// add a zero in front of numbers<10
m=checkTime(m)
s=checkTime(s)
document.getElementById('Time').innerHTML=h+":"+m+":"+s
}
function checkTime(i)
{
if (i<10)
{i="0" + i}
return i
}
</script>
<br>
<table border=1 bordercolor=navy cellpadding=0 cellspacing=0>
<tr>
<td>
<div class=TableTitle><%%DETAIL_VIEW_TITLE%%></div>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td colspan=2></td>
<td rowspan=6 valign=top>
<div><%%INSERT_BUTTON%%></div>
<br>
<div><%%UPDATE_BUTTON%%></div>
<div><%%DELETE_BUTTON%%></div>
<div><%%DESELECT_BUTTON%%></div>
</td>
</tr>
<tr>
<td class=TableHeader valign=top>
<div class=TableHeader style="text-align:right;"><input type="button" value="Start Time" onClick="startTime()"></div>
</td>
<td class=TableBody width=300><div id=Time input size=10 type=text class=TextBox name=Type_I_StartTime value="<%%VALUE(Type_I_StartTime)%%>"> </div></td>
</tr>
</table>
</td>
</tr>
</table>
Any help would be greatly appreciated... Thanks
Dave