Click to See Complete Forum and Search --> : Format Time textbox


ljcharlie
05-05-2003, 08:03 PM
Is anyone know a script that I can use to check and format a Time textbox that user enter in. For example, a user may enter 7 and the script would interpret as something like 07:00:00 The goal is I want to store this value into a MySQL Time data type database field.

Many thanks in advance!

ljCharlie

Jona
05-05-2003, 08:58 PM
<input type=text onkeydown="format(this)" onkeyup="format(this)">

function:

function format(t){
t.value="0"+t.value+":00:00";
}