function isZipcode(objField,displayFieldName){
    var s = new String(objField.attr("value"));

    if (s.length != 5 && s.length != 10)
    // inappropriate length
        return false;


    for (var i=0; i < s.length; i++)
        if ((s.charAt(i) < '0' || s.charAt(s) > '9') && s.charAt(i) != '-')
        {
            errorMessage = "Invalid Zip Code for " + displayFieldName ;
            DisplayError(objField,errorMessage);
            return false;
        }
    return true;
}
// string is valid, it returns true, else false.
string is valid, it returns true, else false.
string is valid it returns true else false .
function isZipcode(objField,displayFieldName){
    var s = new String(objField.attr("value"));
    if (s.length != 5 && s.length != 10)
        return false;
    for (var i=0; i < s.length; i++)
        if ((s.charAt(i) < '0' || s.charAt(s) > '9') && s.charAt(i) != '-')
        {
            errorMessage = "Invalid Zip Code for " + displayFieldName ;
            DisplayError(objField,errorMessage);
            return false;
        }
    return true;
}
function isZipcode ( objField , displayFieldName ) { var s = new String ( objField . attr ( "value" ) ) ; if ( s . length != 5 && s . length != 10 ) return false ; for ( var i = 0 ; i < s . length ; i ++ ) if ( ( s . charAt ( i ) < '0' || s . charAt ( s ) > '9' ) && s . charAt ( i ) != '-' ) { errorMessage = "Invalid Zip Code for " + displayFieldName ; DisplayError ( objField , errorMessage ) ; return false ; } return true ; }
string is valid, it returns true, else false.
string is valid it returns true else false .
// inappropriate length