function FormatDate(cname)
{
if (cname == null)
{
return false;
}
var re = new RegExp(/(d{6})(d{2})?/);
var v1 = cname.value;
if (cname.value.length > 0)
{
if (cname.value.length == 8)
{
if(!re.test(cname.value))
{
cname.value = ‘0’+v1.substring(0,1)+’/’+’0’+v1.substring(2,2)+v1.substring(2,v1.length+1);
}
else
{
cname.value = v1.substring(0, 2) + ‘/’ + v1.substring(2, 4) + ‘/’ + v1.substring(4, 8);
}
}
else if (cname.value.length == 6)
{
if(re.test(cname.value))
{
cname.value = ‘0’+ cname.value.substring(0, 1) + ‘/’ +’0’+ cname.value.substring(1, 2) + ‘/’ + cname.value.substring(2, 6);
}
}
else if (cname.value.length == 7)
{
if(re.test(cname.value))
{
var o = cname.value.substring(0,1);01/22011
alert(“Is”+o);
if(o != 0)
{
cname.value = ‘0’ +cname.value.substring(0, 1) + ‘/’ + cname.value.substring(1, 3) + ‘/’ + cname.value.substring(3, 7);
}
else
{
cname.value = cname.value.substring(0, 2) + ‘/’+’0’+ cname.value.substring(2, 3) + ‘/’ + cname.value.substring(3, 7);
}
}
}
}
}
{
if (cname == null)
{
return false;
}
var re = new RegExp(/(d{6})(d{2})?/);
var v1 = cname.value;
if (cname.value.length > 0)
{
if (cname.value.length == 8)
{
if(!re.test(cname.value))
{
cname.value = ‘0’+v1.substring(0,1)+’/’+’0’+v1.substring(2,2)+v1.substring(2,v1.length+1);
}
else
{
cname.value = v1.substring(0, 2) + ‘/’ + v1.substring(2, 4) + ‘/’ + v1.substring(4, 8);
}
}
else if (cname.value.length == 6)
{
if(re.test(cname.value))
{
cname.value = ‘0’+ cname.value.substring(0, 1) + ‘/’ +’0’+ cname.value.substring(1, 2) + ‘/’ + cname.value.substring(2, 6);
}
}
else if (cname.value.length == 7)
{
if(re.test(cname.value))
{
var o = cname.value.substring(0,1);01/22011
alert(“Is”+o);
if(o != 0)
{
cname.value = ‘0’ +cname.value.substring(0, 1) + ‘/’ + cname.value.substring(1, 3) + ‘/’ + cname.value.substring(3, 7);
}
else
{
cname.value = cname.value.substring(0, 2) + ‘/’+’0’+ cname.value.substring(2, 3) + ‘/’ + cname.value.substring(3, 7);
}
}
}
}
}