JavaScript - Foco al final del texto: Solución :)

 
Vista:

Foco al final del texto: Solución :)

Publicado por Pablo (87 intervenciones) el 05/06/2001 14:51:11
Bueno, tras haber visto varias veces la pregunta y picarme la curiosidad creo ke encontré una solucion para posicionar el cursor al final de un texto escrito en un textarea al devolverle el foco, ahi va:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<html>
<head>
<title>Prueba</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function finalFoco(){
	var obj = document.formulario.campoTexto;
	obj.focus();
	if(obj.value!=""){
		obj.value+="";
	}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="formulario">
  <textarea name="campoTexto"></textarea>
  <input type="button" value="foco()" onClick="finalFoco()">
</form>
</body>
</html>


Espero ke sea de utilidad.
Salu2
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
1
Responder

Foco al final del texto: Solución :)

Publicado por migue (1 intervención) el 23/10/2014 22:53:19
me fue de mucha utilidad, gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar