var hora = document.getElementById('hora');
var dameHora = function(){
var fecha = new Date(),
hora = fecha.getHours(),
minutos = fecha.getMinutes(),
segundos = fecha.getSeconds();
alert("Son las " + hora + ":" + minutos + ":" +segundos);
};
hora.addEventListener('click', dameHora);
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.