Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/04/2011, 00:26
papon
 
Fecha de Ingreso: noviembre-2008
Mensajes: 19
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: ¿cómo invocar función original a la que he sobrecargado?

Cita:
Iniciado por Panino5001 Ver Mensaje
Seguramente lo que hiciste es sobreescribir la función en lugar de "sobrecargarla". Intentá algo así:
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=utf-8" />
<
title>Documento sin título</title>
<
script type="text/javascript">
window.alert = function(native) {
 return function(
m,scope) {
    if(!
scope)
        
native(m);
    else
        
scope.innerHTML=m;
    
 }
}(
window.alert);
onload=function(){
    
alert('hola',document.body);
    
alert('pp');
    
alert('chau',document.body);
    
alert(':)');
}
</script>
</head>

<body>
</body>
</html> 
En efecto parece que no puedo sobrecargarla, sólo sobreescribirla. Muchas gracias por tu ayuda.