...

View Full Version : Creating Custom numeric valadation



edalb1979
09-26-2005, 02:22 PM
Hi all

Ok I am new to this but I was able to get sofar to minipulate some java script to valadate some information. But now I want to make sure that what it valadates is only numeric numbers.

What I have is sofar.




function findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}



function valadateID()
{
a = findObj('a1');

if (a1.value == ""){
alert( "Must have a value." );
return false ;
}
}


Now the valadation works if you put in random information. But I want to make sure that it is only numbers and not characters.

Please can someone give me some advise



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum