Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/07/2009, 11:30
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 2 meses
Puntos: 126
Respuesta: Problema con onblur

Hola

¿Es esto a lo que te referías?

Código javascript:
Ver original
  1. function Evento(elemento,nomevento,funcion) {
  2.   if (elemento.attachEvent)
  3.   {
  4.       var f=function(){
  5.         funcion.call(elemento,window.event);
  6.     }
  7.     elemento.attachEvent('on'+nomevento,f);
  8.     return true;
  9.   }
  10.   else  
  11.     if (elemento.addEventListener)
  12.     {
  13.       elemento.addEventListener(nomevento,funcion,false);
  14.       return true;
  15.     }
  16.     else
  17.       return false;
  18. }
  19.  
  20.  
  21.  
  22. window.onload = function () {
  23. var elemento = document.getElementById("txt");
  24. var elementoDIV = document.getElementById("contenedor");
  25.    
  26.     elemento.onkeyup = function() {
  27.         muestraDIV(elemento.value);
  28.         }
  29.  
  30.     window.onclick = function () {
  31.         OcultarDiv();
  32.         }
  33.  
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. function RellenarCaja(valor) { 
  42. var obj = captura_objeto("contenedor")
  43.         document.getElementById("txt").value = valor;
  44.                 obj.style.display= "none";     
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51. function OcultarDiv() {
  52. var obj = captura_objeto("contenedor")
  53.                 obj.style.display= "none"; 
  54.    
  55. }


El ResponseText trae javascript

Código javascript:
Ver original
  1. <script type="tex/javascript">
  2. var ref = document.getElementById('contenedor').getElementsByTagName('a');
  3. for (var i = 0; i < ref.length; i++) {
  4.   Evento(ref[i], 'click', function() {
  5.       RellenarCaja(this.id);
  6. })    
  7. }
  8. </script>

Tal y como esta funciona, pero ... ¿alguna sugerencia. algo que creas que debo modificar,....?

Gracias
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />