Ver Mensaje Individual
  #4 (permalink)  
Antiguo 16/09/2008, 06:36
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años, 9 meses
Puntos: 834
Respuesta: Eventos en DOM (y sus funciones)

En ese caso no necesitás parámetros, ya que podés referenciar por medio de this:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>test</title>
<
script>
function 
addEvent(obj,type,fn,useCapture){
    if(
obj.addEventListener){
        
obj.addEventListener(type,fn,useCapture);
    }else if(
obj.attachEvent){
        var 
f=function(){
            
fn.call(obj,window.event);
        }
        
obj.attachEvent('on'+type,f);
    }else{
        throw 
'Error';
    }
}
function 
init(){
    
addEvent(document.getElementById('algo'),'focus',function(){alert(this.value+'--'+this.name);},false);
}
onload=init;
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <input name="miNombre" type="text" id="algo" value="miValor" />
</form>
</body>
</html> 
Aquí se habló bastante sobre el tema:
http://www.forosdelweb.com/f13/quien...uncion-621642/