node2:/var/www/html/js#cat h37.html
<img id="example" src="images/example.jpg" alt="A bolt of lightning"
onclick="console.log('At ' + formatDate(new Date()) + ' BOOM!');" />
<script>
function formatDate(date) {
return (date.getHours() < 10 ? '0' : '') + date.getHours() +
':' + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes() +
':' + (date.getSeconds() < 10 ? '0' : '') + date.getSeconds() +
'.' + (date.getMilliseconds() < 10 ? '00' : (date.getMilliseconds() < 100 ? '0' : '')) +
date.getMilliseconds();
}
</script>