js日期格式完美驗證函數function validateshort(form) {
var bvalid = true;
& nbsp; var focusfield = null;
var i = 0;
var fields = new array();
var oshort = eval('new ' + jcv_retrieveformname(form) + '_shortvalidations()');
for (var x in oshort) {
& nbsp; if (!jcv_verifyarrayelement(x, oshort[x])) {
continue;
}
var field = form[oshort[x][0]];
if (!jcv_isfieldpresent(field)) {
continue;
}
if ((field.type == 'hidden' ||
field.type == ' text' ||
field.type == ' textarea' ||
field.type == ' select-one' ||
field.type == ' radio')) {
var value = '';
// get field's value
if ( field.type == "select-one") {
var si = field.selectedindex;
if (si >= 0) {
value = field.options[si].value;
}
} else {
value = field.value;
}
if (value.length > 0) {
if (!jcv_isdecimaldigits(value)) {
bvalid = false;
if (i == 0) {
focusfield = field;
}
fields[i++] = oshort[x][1];
} else {
var ivalue = parseint(value, 10);
if (isnan(ivalue) || !( ivalue >= -32768 && ivalue <= 32767)) {
if (i == 0) {
focusfield = field;
}
fields[i++] = oshort[x][1];
bvalid = false;
}
}
}
}
}
if (fields.length > 0) {
jcv_handleerrors(fields, focusfield);
}
return bvalid;
}