runnerjp Posted March 11, 2009 Share Posted March 11, 2009 currently i have function checkit(which) { var tim = which.value; var flag = 0; if (!/^\d{1,2}[-:\.]\d{2}/.test(tim)) { // basic format flag = 1; } tim = tim.replace(/[-\.]/g,":"); tim = tim.split(/:/); if ((tim[0] > 23) || tim[1] > 59) { // hour or minute values too great flag = 1; } if (flag == 1) { alert ("This field requires a valid time!" ); which.value = ""; which.focus(); return false; } } but the thing is it wont allow i time such as 45.6's to be entred...how could i chnage this? Link to comment https://forums.phpfreaks.com/topic/148962-only-allowing-time-to-be-inserted-into-textbox/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.