I have a VERY extensive HTML form for collecting data during a complex manufacturing process. The data collection requires users to stamp the date and time in perhaps 80 separate fields - and I am using buttons as labels for each of the data fields.

I have a JavaScript function which gives me the desired results for an individual field - but I don't want to have to duplicate the code for the function and change the name for each required entry.

I'm a novice at Javascript and only a beginner at HTML - but I know this can be done... I just can't figure out how. I know it has to do with passing the ID tag for my HTML fields (into a loop?) to be used as variables in the code... but I'm not clear on how.

Here's the code I'm thinking of using for my timestamp (setup for 1 field):

```
<script type="text/javascript">
function getClockTime()
{
   var now    = new Date();
   var hour   = now.getHours();
   var minute = now.getMinutes();
   var second = now.getSeconds();
   if (hour   < 10) { hour   = "0" + hour;   }
   if (minute < 10) { minute = "0" + minute; }
   if (second < 10) { second = "0" + second; }
   var timeString= hour +
                    ':' +
                    minute +
                    ':' +
                    second
document.getElementById("txtTime").value = timeString;
}
</script> 

```

If someone can give me a clue about how to approach this I'd sure appreciate it.