Ver Mensaje Individual
  #7 (permalink)  
Antiguo 29/06/2010, 18:17
Avatar de _cronos2
_cronos2
Colaborador
 
Fecha de Ingreso: junio-2010
Mensajes: 2.062
Antigüedad: 13 años, 11 meses
Puntos: 310
Respuesta: Script acortar texto?

Cita:
Iniciado por maycolalvarez Ver Mensaje
Código Javascript:
Ver original
  1. if (mitexto.length() > 50){
length es la propiedad que tiene la clase String, no un método, y por tanto no lleva paréntesis.
Código Javascript:
Ver original
  1. window.onload = function(){
  2.  este = document.getElementById('fuente');
  3.  var texto = este.innerText || este.textContent;
  4.  if(texto.length>50){
  5.   textOk = texto.substring(0, 50) + '...';
  6.   texto = textOk;
  7.  }
  8. }
Código HTML:
Ver original
  1. <td colspan="2" height="1"><font color="#999" size="1" id='fuente'>{cat_description}</font></td>

Saludos (: