Ciao a tutti.

Con ricerca ho trovato questo codice js che permette l'inserimento in un form di un'orario formato hh:mm, con i : che tramite la funzione insertColon si autoinseriscono:

codice:
function insertColon(id){
	var stringa = document.getElementById(id).value;
	var ore = stringa.substr(0,2);
	var min = stringa.substr(2,2);
	
	var new_ = ore + ":" + min;
	document.getElementById(id).value = new_;
}

function validateForm(theform)

{ 

	var re = /^(0?\d|(1\d|2[0-3])):[0-5]\d(:[0-5]\d)?$/;

	if (!Qform.Ora_evento.value.match(re))
    	{
      	alert("L\'\orario va inserito nel formato HHMM !");
      	Qform.Ora_evento.focus();
      	Qform.Ora_evento.select();

             }
  
	return(true);
  
}
Come la devo modificare se volessi anche i secondi, cioè un formato orario del tipo hh:mm:ss ?

Grazie