bloodless_1999
01-08-2003, 08:46 PM
Can anyone tell me what the following code does? I know what it's SUPPOSED to do, but not what it actuall does. I've been staring at it for a LONG time, and can't get it.
var valid = new Object();
valid.Currency = /\u\d{6}$/;
var elArr = form1.elements;
for(var i = 0; i < elArr.length; i++) {
with(elArr[i]) {
var v = elArr[i].validator;
if(!v) continue;
var thePat = valid[v];
var gotIt = thePat.exec(value);
if(! gotIt){
alert("Please Fill out the EMPLOYEE NUMBER field correctly using the letter U and numbers. (Ie. U123456)");
elArr[i].select();
elArr[i].focus();
return false;
}
}
}
... later ...
<input name="EmplNum" validator="Currency" size="10">
TIA for any help!
var valid = new Object();
valid.Currency = /\u\d{6}$/;
var elArr = form1.elements;
for(var i = 0; i < elArr.length; i++) {
with(elArr[i]) {
var v = elArr[i].validator;
if(!v) continue;
var thePat = valid[v];
var gotIt = thePat.exec(value);
if(! gotIt){
alert("Please Fill out the EMPLOYEE NUMBER field correctly using the letter U and numbers. (Ie. U123456)");
elArr[i].select();
elArr[i].focus();
return false;
}
}
}
... later ...
<input name="EmplNum" validator="Currency" size="10">
TIA for any help!