Ver Mensaje Individual
  #273 (permalink)  
Antiguo 05/08/2008, 11:39
Avatar de marcopoloaz06
marcopoloaz06
 
Fecha de Ingreso: julio-2007
Ubicación: México
Mensajes: 457
Antigüedad: 16 años, 9 meses
Puntos: 11
Sonrisa 274.- PUNTEROS en un Array

P:¿ Cómo usar las funciones de PHP current(),next(),prev(),end(),reset(), en JavaScript ?
R: [EJEMPLO]

asi:
Código HTML:
<script type="text/javascript">
(function(){
// PUNTEROS ARRAY
Array.prototype.currentNum = 0;
Array.prototype.current = function(){
    return this[ this.currentNum ];
};
Array.prototype.next = function(){
    return this.currentNum+1<this.length ? this[ ++this.currentNum ] : false;
};
Array.prototype.prev = function(){
    return this.currentNum-1>0 ? this[ --this.currentNum ] : false;
};
Array.prototype.end = function(){
    return this.length>0 ? this[ this.currentNum = this.length-1 ] : false;
};
Array.prototype.reset = function(){
    return this[ this.currentNum = 0 ];
};
})();
</script> 
pueden ver el ejemplo

Saludos
:]
__________________
Aerolíneas Alicia :D

Última edición por marcopoloaz06; 01/09/2008 a las 11:15