Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/01/2011, 13:45
Avatar de _cronos2
_cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 13 años, 10 meses
Puntos: 310
Función se vuelve undefined de repente

Tengo esta función para controlar la opacidad de un elemento. Lo que hago es que si tiene argumentos, la seteo, y si no devuelvo su opacidad actual. Lo tengo así:
Código Javascript:
Ver original
  1. HTMLElement.prototype.opacity=function(){
  2.  var isIE = document.all, estilos = isIE ? ['filters', 'alpha', 100] : ['style', 'opacity', 1];
  3.  if(arguments.length)
  4.   this[estilos[0]][estilos[1]] = arguments[0] * estilos[2];
  5.  else{
  6.   if(this[estilos[0]][estilos[1]]){
  7.    return this[estilos[0]][estilos[1]]/estilos[2];
  8.   }else{
  9.    alert(SS==undefined); // false
  10.    if(SS.find(this.tagName, isIE?'filter':'opacity')){
  11.     return isIE?(SS.find(this.tagName, 'filter')).match(/\d+/)[0]/100:SS.find(this.tagName, 'opacity');
  12.    }else{
  13.     alert(SS==undefined); // true
  14.     if(SS.find('#'+this.id, isIE?'filter':'opacity'))
  15.      return isIE?(SS.find('#'+this.id, 'filter')).match(/\d+/)[0]/100:SS.find('#'+this.id, 'opacity');
  16.     else{
  17.      for(var i=0, partir=this.className.split(' '); clase=partir[i]; i++){
  18.       if(SS.find('.'+clase, isIE?'filter':'opacity'))
  19.        return isIE?(SS.find('.'+clase, 'filter')).match(/\d+/)[0]/100:SS.find('.'+clase, 'opacity');
  20.      }
  21.     }
  22.    }
  23.   }
  24.  }
  25.  return 1;
  26. };
SS es un objeto para trabajar con StyleSheets, pero a mitad de la función deja de reconocerlo
¿Alguien ve el problema? Yo llevo desde ayer y nada.
Saludos (:
__________________
" Getting older’s not been on my plans
but it’s never late, it’s never late enough for me to stay. "
Cigarettes - Russian Red