Código HTML:
function mays(campo)
{
campo.value = campo.value.toUpperCase();
}
function validate()
{
var Validar = new clsValidator();
numerr = 0;
Validar.setEncabezado("** Se encontraron los siguientes errores en el formulario 25**");
Validar.setErrorColor("#FFFFCC");
// VALIDA SECCION 0
Validar.Vacio("ofiminco", "Debe llenar Oficina");
// VALIDA SECCION 1
Validar.Vacio("razon", "Debe llenar 1.1 Razon Social ");
Validar.Vacio("nit", "Debe llenar 1.2 Nit ");
Validar.Vacio("direccion", "Debe llenar 1.3 Dirección");
Validar.Vacio("telef", "Debe llenar 1.3 Telefonos");
Validar.Vacio("nomciudad", "Debe llenar 1.3 Ciudad");
Validar.Email("email", "El email de 1.3 no es válido");
Validar.Vacio("replegal", "Debe llenar 1.4 Representante Legal");
Validar.Vacio("cargo", "Debe llenar 1.4 Cargo");
// VALIDA SECCION 5
Validar.Vacio("secuencia0", "Debe llenar 5.1 Nombre Tecnico");
Validar.Vacio("descrip0", "Debe llenar 5.1 Subpartida");
Validar.Vacio("cantidade0", "Debe llenar 5.1 Pais de Origen");
Validar.Vacio("criterio0", "Debe llenar 5.1 Pais de Procedencia");
Validar.Vacio("marca0", "Debe llenar 5.1 Unidad de Medida");
Validar.Vacionum("pesoneto0", "Debe llenar 5.1 Cantidad");
Validar.Vacionum("gross0", "Debe llenar 5.1 Valor CIF");
Validar.Vacionum("valorfca0", "Debe llenar 5.1 Valor Planta");
Validar.Vacionum("fecha0", "Debe llenar 5.1 Valor Planta");
var cont = document.getElementById('numfila5').value
if (cont > 0)
{
for(p=1;p<=cont;p++)
{
var q = p+1;
var campo = "Debe llenar 5."+q+" Nombre Tecnico";
Validar.Vacio(document.getElementById('secuencia'+p).name,campo);
campo = "Debe llenar 5."+q+" Subpartida";
Validar.Vacio(document.getElementById('descrip'+p).name,campo);
campo = "Debe llenar 5."+q+" Pais Origen";
Validar.Vacio(document.getElementById('candidade'+p).name,campo);
campo = "Debe llenar 5."+q+" Pais Procedencia";
Validar.Vacio(document.getElementById('criterio'+p).name,campo);
campo = "Debe llenar 5."+q+" Unidad de Medida";
Validar.Vacio(document.getElementById('marca'+p).name,campo);
campo = "Debe llenar 5."+q+" Cantidad ";
Validar.Vacionum(document.getElementById('pesoneto'+p).name,campo);
campo = "Debe llenar 5."+q+" Valor CIF";
Validar.Vacionum(document.getElementById('gross'+p).name,campo);
campo = "Debe llenar 5."+q+" Valor Planta";
Validar.Vacionum(document.getElementById('valorfca'+p).name,campo);
campo = "Debe llenar 5."+q+" Valor Planta";
Validar.Vacionum(document.getElementById('Fecha'+p).name,campo);
}
}
// VALIDACION FINAL
if (Validar.Validar()) alert("Documento Diligenciado Correctamente");
else Validar.getErrors();
}
function clsValidator()
{
/* Data members */
this.msgError=""; // Return the msg error
this.errorColor=""; //error color Format: #00708c
this.error = false;
/* Methods */
function setEncabezado(head)
{
this.head = head;
}
function AgregarError() {
this.error=true;
numerr++;
this.msgError += "* "+" "+numerr+". "+arguments[0]+"\n";
for (var y=1; y < arguments.length ; y++)
{
document.getElementById(arguments[y]).style.backgroundColor=this.errorColor;
}
}
///////////////////////////////////////////////////////////
function EliminarError()
{
for (var y=0; y < arguments.length ; y++)
{
document.getElementById(arguments[y]).style.backgroundColor="";
}
}
function setErrorColor(color)
{
this.errorColor = color;
}
///////////////////////////////////////////////////////////
function Vacio(field,msg)
{
this.EliminarError(field);
if (document.getElementById(field).value.replace(/ /g, '') == "")
{
this.AgregarError(msg, field);
return false
}
return true
}
function Vacionum(field,msg)
{
this.EliminarError(field);
if (document.getElementById(field).value <= 0)
{
this.AgregarError(msg, field);
return false
}
return true
}
///////////////////////////////////////////////////////////
function Porcentaje(field,msg)
{
this.EliminarError(field);
if ( (document.getElementById(field).value > 100) || (document.getElementById(field).value.length > 6) )
{
this.AgregarError(msg, field);
return false
}
return true
}
function Vaciosec4(field,msg)
{
this.EliminarError(field);
if ( (document.getElementById('biencap').value == "") && (document.getElementById('matpri').value == "")
&& (document.getElementById('servicio').value == ""))
{
this.AgregarError(msg, field);
return false
}
return true
}
function Sumasec7(field,msg)
{
var valor71 = document.getElementById('vr71').value
var valor72 = document.getElementById('vr72').value
var valor511 = document.getElementById('tot5112').value
var suma1 = parseInt(valor71) + parseInt(valor72) + parseInt(valor511)
var valor7a = document.getElementById('vr7a').value
var valor7b = document.getElementById('vr7b').value
var suma2 = parseInt(valor7a) + parseInt(valor7b)
this.EliminarError(field);
if ( suma2 < suma1 )
{
this.AgregarError(msg, field);
return false
}
return true
}
//////////////////////////////////////////////////////////
function Email(field,msg)
{
this.EliminarError(field);
var re = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
if (!re.test(document.getElementById(field).value)) {
this.AgregarError(msg, field);
return false
}
return true
}
function Fecha(field, msg)
{
this.EliminarError(field);
var datePat = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})?$/;
var matchArray = document.getElementById(field).value.match(datePat);
var ok = true;
if (matchArray == null) ok = false;
else
{
day = matchArray[1];
month = matchArray[2];
year = matchArray[3];
if ((day < 1 || day > 31) || (month < 1 || month > 12) || (year < 1)) ok = false;
if ((month ==2 || month == 4 || month == 6 || month ==9 || month ==11) && (day > 30)) ok = false;
if (month == 2)
{
bisiesto = (parseInt (year/4))*4
if ((year != bisiesto) && (day > 28)) ok = false;
if ((year == bisiesto) && (day > 29)) ok = false;
}
}
if (ok) return true
else
{
this.AgregarError(msg, field);
return false;
}
}
function Iguales(field1, field2, msg)
{
this.EliminarError(field1,field2);
if(document.getElementById(field1).value != document.getElementById(field2).value)
{
this.AgregarError(msg, field1, field2);
return false
}
return true
}
function Longitud(field, operator, length, msg)
{
this.EliminarError(field);
if (operator == "=") operator = "==";
if ( !(eval("document.getElementById(field).value.length "+operator+" length")) )
{
this.AgregarError(msg, field);
return false
}
return true
}
function Validar()
{
return !this.error;
}
function getErrors()
{
alert(this.head+"\n\n"+this.msgError);
}
///////////////////////////////////////////////////////////
this.setEncabezado = setEncabezado;
this.setErrorColor = setErrorColor;
this.getErrors = getErrors;
this.AgregarError = AgregarError;
this.EliminarError = EliminarError;
this.Vacio = Vacio;
this.Vacionum = Vacionum;
this.Porcentaje = Porcentaje;
this.Vaciosec4 = Vaciosec4
this.Sumasec7 = Sumasec7
this.Email = Email;
this.Fecha = Fecha;
this.Iguales = Iguales;
this.Longitud = Longitud;
this.Validar = Validar;
}
function validate_O()
{
var Validar = new clsValidator();
numerr = 0;
Validar.setEncabezado("** Se encontraron los siguientes errores en el formulario **");
Validar.setErrorColor("#FFFFCC");
// Validar.Vacio("nombre_exp", "Debe llenar 1.1 El Nombre ");
Validar.Vacio("direccion_exp", "Debe llenar 1.2 la Direccion ");
Validar.Vacio("nombre_imp", "Debe llenar 2.1 El Nombre ");
Validar.Vacio("direccion_imp", "Debe llenar 2.2 La Direccion ");
Validar.Vacio("telefono_imp", "Debe llenar 2.3 El Telefono ");
Validar.Vacio("medio_trans", "Debe llenar 3 El Medio de Transporte");
// VALIDA SECCION 3
if (Validar.Validar())
{
//.style.display='none'
alert("Documento Diligenciado Correctamente");
w_valida = 1;
habilita_graba();
document.getElementById('valida').style.display='none';
}
else Validar.getErrors();
}
function deshabilita_graba()
{
document.getElementById('graba').style.display='none';
}
function habilita_graba()
{
document.getElementById('graba').style.display='block';
}
function deshabilita_imput()
{
campos=document.getElementById('seccion1').getElementsByTagName('input');
for (x=0;x<campos.length;x++)
{
campos[x].disabled=true;
}
}
function deshabilita_pais()
{
campos=document.getElementById('seccion1').getElementsByTagName('select');
for (x=0;x<campos.length;x++)
{
campos[x].disabled=true;
}
}
function deshabilita_mediotrans()
{
campos=document.getElementById('seccion1').getElementsByTagName('textarea');
for (x=0;x<campos.length;x++)
{
campos[x].disabled=true;
}
}
Bueno aqui va la otra parte

espero que me puedan dar una mano ya que llevo un par de dias tratando de arreglar el problema y no e podido

.
Hasta Pronto!