I try to validate inpute field for weight that accept only numeric value like 65.12 not allow any special character or character but allow '.' .
thanks
jha
thanks
jha
function ck_wt(obj)
{
if(obj.value=="")
{
obj.focus();
alert("Wt. Must be entered.")
}
else if(obj.value<0 || obj.value=="")
{
obj.focus();
alert("wait must be +ve")
return;
}
else if(!obj.value.match(/^\d+$/)){
obj.focus();
alert("Only numbers are allowed.");
return;
}
}
function ck_wt(obj)
{
if(obj.value=="")
{
obj.focus();
alert("Wt. Must be entered.")
}
else if(obj.value<0 || obj.value=="")
{
obj.focus();
alert("wait must be +ve")
}
else if(obj.value.match(/^\d{2}\.\d{2}$/))
{
obj.focus();
alert ("testing")
return;
}
}
function ck_wt(obj)
{
if(obj.value=="")
{
obj.focus();
alert("Wt. Must be entered.")
}
else if(obj.value<0 || obj.value=="")
{
obj.focus();
alert("wait must be +ve")
}
else if(obj.value.match(/^\d{2}\.\d{2}$/))
{
obj.focus();
alert ("testing")
return;
}
}
Comment