Ver Mensaje Individual
  #7 (permalink)  
Antiguo 26/02/2015, 13:48
Avatar de GeekGirl
GeekGirl
 
Fecha de Ingreso: julio-2014
Mensajes: 423
Antigüedad: 9 años, 10 meses
Puntos: 44
Respuesta: Error al validar un formulario en IE

A tu función le falta declarar las variables varCliente y varCodProducto como me suponía. Debería ser así:

Código Javascript:
Ver original
  1. function validacion () {
  2.  
  3. var varCliente     = document.getElementById("varCliente");
  4. var varCodProducto = document.getElementById("varCodProducto");
  5.  
  6. if (varCliente.value == "") {
  7. // Si no se cumple la condicion...
  8. alert('El campo Cliente no puede estar vacio');
  9. varCliente.style.backgroundColor = "#FFFFCC";
  10. varCliente.focus();
  11. return false;
  12.  
  13. }
  14. else if (varCodProducto.value == "") {
  15. // Si no se cumple la condicion...
  16. varCliente.style.backgroundColor = "#CCFFCC";
  17. alert('El campo Cod Producto no puede estar vacio');
  18. varCodProducto.style.backgroundColor = "#FFFFCC";
  19. varCodProducto.focus();
  20. return false;
  21.  
  22. } else {
  23. return true;
  24. };

Saludos :)