Ver Mensaje Individual
  #12 (permalink)  
Antiguo 27/10/2012, 10:46
furoya
(Desactivado)
 
Fecha de Ingreso: noviembre-2002
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 2.367
Antigüedad: 21 años, 6 meses
Puntos: 317
Respuesta: Numerar lineas de un textarea

Muy prometedora tu última edición. Termino de mandar este post y la veo.
De cualquier forma, si nos atenemos al caso inicial, no hay espacios en las url, y en la misma linea tampoco hay más texto.


Cita:
Iniciado por IsaBelM Ver Mensaje
sí que nos interesó ...
A vos. A mí nunca me importó.


Hemos parasitado cada tema...
Y acá nadie se puede quejar, todavía no empezamos a hablar de figuras religiosas, bares notables o identidad de género.

Lo que sí ya me harté de abandonar el "paso más allá".
Voy a darme una vuelta por tu tema sobre rotación de banners la próxima semana.


Por ahora, te sigo el juego.
Y completo aquí lo que te mencioné más arriba, emprear.

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<title>TEXTAREA CON LÍNEAS NUMERADAS.</title>
<script type="text/javascript">

function numeraLinea() {
 var caja = document.getElementById("cajaNumerada");
 var numerador = document.getElementById("numeros");
 var texto = document.getElementById("numerable");
 var parrafos = texto.value.split("\n").length; 

 texto.rows = parrafos+1; 
 texto.scrollLeft = 1; 
 numerador.innerHTML = "";
 numerador.style.visibility = "visible";
 caja.style.height = texto.offsetHeight +"px";

 for(p=0; p<parrafos; p++) {
  numerador.innerHTML += (p+1) +".<br>"
 }

 texto.style.paddingLeft = (numerador.offsetWidth+2) + "px";

}

function edita() {
 document.getElementById("numeros").style.visibility = "hidden";
}

//onload = numeraLinea;
</script>
<style type="text/css">
#cajaNumerada {padding: 0; position: relative; height: 210px; }

#numeros {padding: 1px 2px; position: absolute; top: 0; left: 0; font-weight: bold; 
background-color: silver; font-size: 14px; line-height: 1.2; text-align: right; }

#numerable {padding: 0 0 0 2em; position: absolute; top: 0; left: 0; margin: 0; 
resize: horizontal; background-color: transparent; font-size: 14px; line-height: 1.2; 
border: 1px solid black; }

</style>
</head>
<body>
<h2>Numera líneas reales fuera del texto.</h2>

<div id=cajaNumerada>
<div id=numeros></div>
<textarea id=numerable wrap=off onblur="numeraLinea()" 
onfocus="edita()" rows=12>ALFA
BRAVO 
CHARLY 
DELTA 
ECO 
FOXTROT FOXTROT FOXTROT FOXTROT FOXTROT FOXTROT FOXTROT FOXTROT FOXTROT FOXTROT 
GOLF 
HOTEL 
INDIO
JULIETA
KILO</textarea>
</div>

<p>La numeración aparece al dejar la edición del <code>textarea</code>. </p>

</body>
</html>
Funciona en todos los navegadores (¡hasta en IE6!).


ajustar tamaño de textarea al contenido

textarea en una linea entera

Líneas virtuales numeradas.

textarea{text-indent:2em;} en OPERA no funciona

cuantos lineas de texto tengo en un div?