Codigos de programación

Seleccionar el contenido de un area de texto


Este script nos sirve para seleccionar todo lo que tenemos en un area de texto.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Russ (NewXS3@aol.com) -->
<!-- Web Site: http://dblast.cjb.net -->
<!-- Begin
function copyit(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand("Copy")
}
// End -->
</script>

</head>

<body>

<form name="it">
<div align="center">
<input onclick="copyit('it.select1')" type="button" value="Seleccionar el texto"
name
="cpy">
</div>
<p align="center"><textarea name="select1" rows="3" cols="25">
Texto del formulario, que sera Seleccionado con JavaScript</textarea></p>
</form>

</body>
</html>

0 comentarios: