| Server IP : 27.254.152.13 / Your IP : 216.73.217.38 Web Server : Apache/2 System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64 User : coloflew ( 1072) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/coloflew/.trash/files/fulltion.co.th/public_html/parcel/administrator/js/ |
Upload File : |
var n;
var p;
var p1;
var fl;
function ValidatePhone(){
p=p1.value
if(p.length==1){
pp=p;
$("#"+fl).val('');
$("#"+fl).val(pp);
}
if(p.length==2){
pp=p;
d5=p.indexOf(':')
if(d5==-1){
pp=pp+":";
}
$("#"+fl).val('');
$("#"+fl).val(pp);
}
if(p.length>4 && p.length<5){
pp=p;
$("#"+fl).val('');
$("#"+fl).val(pp);
}
if(p.length==5){
pp=p;
pp=pp+":";
$("#"+fl).val('');
$("#"+fl).val(pp);
}
setTimeout(ValidatePhone,100)
}
function getIt(m,f){
n=m.name;
//p1=document.forms[0].elements[n]
fl = f;
p1=m
ValidatePhone()
}
function validatetime(fl)
{
var strval = $("#"+fl).val();
var strval1;
//minimum lenght is 6. example 1:2 AM
if(strval.length < 6)
{
alert("Invalid time. Time format should be HH:MM:SS");
$("#"+fl).val('');
return false;
}
//Maximum length is 8. example 10:45 AM
if(strval.lenght > 8)
{
alert("invalid time. Time format should be HH:MM:SS");
$("#"+fl).val('');
return false;
}
//Removing all space
strval = trimAllSpace(strval);
//Checking hours
timesplit = strval.split(":");
var horval = trimString(timesplit[0]);
if(horval == -100)
{
alert("Invalid time. Hour should contain only integer value (0-11).");
$("#"+fl).val('');
return false;
}
if(horval > 59)
{
alert("invalid time. Hour can not be greater that 59.");
$("#"+fl).val('');
return false;
}
else if(horval < 0)
{
alert("Invalid time. Hour can not be hours less than 0.");
$("#"+fl).val('');
return false;
}
//Completes checking hours.
//Checking minutes.
var minval = trimString(timesplit[1]);
if(minval == -100)
{
alert("Invalid time. Minute should have only integer value (0-59).");
$("#"+fl).val('');
return false;
}
if(minval > 59)
{
alert("Invalid time. Minute can not be more than 59.");
$("#"+fl).val('');
return false;
}
else if(minval < 0)
{
alert("Invalid time. Minute can not be less than 0.");
$("#"+fl).val('');
return false;
}
//Checking minutes completed.
//Checking minutes.
var secoundval = trimString(timesplit[2]);
if(secoundval == -100)
{
alert("Invalid time. Secound should have only integer value (0-59).");
$("#"+fl).val('');
return false;
}
if(secoundval > 59)
{
alert("Invalid time. Secound can not be more than 59.");
$("#"+fl).val('');
return false;
}
else if(secoundval < 0)
{
alert("Invalid time. Secound can not be less than 0.");
$("#"+fl).val('');
return false;
}
//Checking minutes completed.
return true;
}
function trimString(str)
{
var str1 = '';
var i = 0;
while ( i != str.length)
{
if(str.charAt(i) != ' ') str1 = str1 + str.charAt(i); i++;
}
var retval = IsNumeric(str1);
if(retval == false)
return -100;
else
return str1;
}
function IsNumeric(strString)
{
var strValidChars = "0123456789";
var strChar;
var blnResult = true;
//var strSequence = document.frmQuestionDetail.txtSequence.value;
//test strString consists of valid characters listed above
if (strString.length == 0)
return false;
for (i = 0; i < strString.length && blnResult == true; i++)
{
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
}
return blnResult;
}
function trimAllSpace(str)
{
var str1 = '';
var i = 0;
while(i != str.length)
{
if(str.charAt(i) != ' ')
str1 = str1 + str.charAt(i); i ++;
}
return str1;
}