Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/07/2013, 04:24
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 1 mes
Puntos: 574
Respuesta: No hacer nada cuando se introduzcan espacios

Sorry no me vi que IE no lo sabe hacer hasta la versión 9, siempre dando....

Código HTML:
Ver original
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <title>Documento sin t&iacute;tulo</title>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <script language="JavaScript" type="text/JavaScript">
  5. if(typeof String.prototype.trim !== 'function') {
  6.   String.prototype.trim = function() {
  7.     return this.replace(/^\s+|\s+$/g, '');
  8.   }
  9. }
  10.  
  11. function es_vacio(){
  12.   var valor=document.getElementById('matricula').value;
  13.   valor=valor.trim();
  14.     if (valor== ""){  
  15.      
  16.             document.getElementById('boton_busqueda').disabled=true;
  17.    
  18.     }else{
  19.  
  20.             document.getElementById('boton_busqueda').disabled=false;    
  21.     }
  22. }
  23.  
  24.  
  25.  
  26.  
  27.  
  28. </head>
  29.  
  30. <input name="matricula" type="text" id="matricula" onBlur="es_vacio()">
  31. <input name="boton_busqueda" type="button" id="boton_busqueda" value="boton_busqueda" disabled>
  32. </body>
  33. </html>

Usa esto en IE 8 funciona... no se si en las anteriores....
__________________
Quim
--------------------------------------------------
Ayudar a ayudar es una buena práctica!!! Y da buenos resultados.