cmc-sales/webroot/js/quotenik/add_datetime.js
Karl Cordes 4347aee5f0 Changes
2009-11-04 17:12:12 +11:00

24 lines
629 B
JavaScript
Executable file

/* Adds Date/Timestamp to a comments field when it's selected for modifiying. */
Event.observe(window, 'load', function() {
$('comments').disable();
});
function datetime(userinitials) {
$('comments').enable();
$('datebutton').disable();
var currentTime = new Date();
month = currentTime.getMonth() + 1;
day = currentTime.getDate();
year = currentTime.getFullYear();
hour = currentTime.getHours();
minute = currentTime.getMinutes();
if(minute < 10) {
minute = '0'+minute;
}
$('comments').value = '[' + day + '-' + month + '-' + year + ' @' + hour + ':' + minute +' '+ userinitials +']' + '\n' + $('comments').value;
}