ericbrown2
Technical User
Hey guys, I'm new here and I have a absolute zero level of coding knowlege. I am creating a DAP database for my department at work and am trying to set up a site log that users can log technicians into. The problem is that right now you have to manually enter the time/date they arrive onsite and the time/date they leave. I found a javascript code that will stamp the current time when you click the target but I can't get the results (current date/time) to appear in the time/date field. Here's the Javascript code:
At this time, if you click the field "time_in", it generates the current time/date, but it places it in a new blank page. If someone could help me I'd really appreciate it. Oh yeah, if it helps I'm on XP Pro at work and running the DAP on our intranet.
Code:
SCRIPT language=JavaScript event=onclick for=time_in>
<!-- Begin
Stamp = new Date();
year = Stamp.getYear();
if (year < 2000) year = 1900 + year;
document.write('<font size="2" face="Arial"><B>' + (Stamp.getMonth() + 1) +"/"+Stamp.getDate()+ "/"+ year + '</B></font><BR>');
var Hours;
var Mins;
var Time;
Hours = Stamp.getHours();
if (Hours >= 12) {
Time = " P.M.";
}
else {
Time = " A.M.";
}
if (Hours > 12) {
Hours -= 12;
}
if (Hours == 0) {
Hours = 12;
}
Mins = Stamp.getMinutes();
if (Mins < 10) {
Mins = "0" + Mins;
}
document.write('<font size="2" face="Arial"><B>' + Hours + ":" + Mins + Time + '</B></font>');
// End-->
At this time, if you click the field "time_in", it generates the current time/date, but it places it in a new blank page. If someone could help me I'd really appreciate it. Oh yeah, if it helps I'm on XP Pro at work and running the DAP on our intranet.