Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/10/2008, 21:22
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
Puntos: 834
Respuesta: cuantos lineas de texto tengo en un div?

Fijate si algo así te sirve (y no repitas tus mensajes):
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>
onload=function(){
/* esto es para averiguar cual es el valor offsetTop del último renglón, que en este caso es 89 (aparece como title en cada letra)
    var txt='<span onmouseover="this.title=this.offsetTop">'+document.getElementById('ej').innerHTML.split('').join('</span><span  onmouseover="this.title=this.offsetTop">')+'</span>';
    document.getElementById('ej').innerHTML=txt;
*/
    
var txt='<span>'+document.getElementById('ej').innerHTML.split('').join('</span><span>')+'</span>';
    
document.getElementById('ej').innerHTML=txt;
    var 
t='';
    for(var 
i=0l=document.getElementById('ej').getElementsByTagName('span'),ll=l.length;i<ll;i++)
        if(
l[i].offsetTop<=89)
            
t+=l[i].innerHTML;
        else
            break;
        
document.getElementById('ej').innerHTML=t;
}
</script>
</head>

<body>
<div id="ej" style="width:300px; height:200px;">Hola que tal necesito verdaderamente ayuda con esto!!!
Necesito cortar el texto a partir de la 5 ta linea de texto que tengo en un div, digamos q de la 6 ta linea inclusive en adelante lo tengo que cortar.
GRACIASHola que tal necesito verdaderamente ayuda con esto!!! Necesito cortar el texto
a partir de la 5 ta linea de texto que tengo en un div, digamos q de la 6 ta
linea inclusive en adelante lo tengo que cortar. GRACIAS</div>
</body>
</html>