Simplemente ingrese el código y use JS para controlar la inserción en la posición del cursor.
Se usa al implementar la inserción de expresiones.
La copia del código es la siguiente:
<span style = "font-size: 18px;"> <html>
<Evista>
<script type = 'text/javaScript'>
prueba de función (str) {
var tc = document.getElementById ("myTexTarea");
var tclen = tc.Value.length;
tc.focus ();
if (typeof document.selection! = "Undefined")
{
document.selection.createrGe (). Text = str;
}
demás
{
tc.value = tc.value.substr (0, tc.selectionStart)+str+tc.value.substring (tc.selectionStart, tclen);
}
}
</script>
</ablo>
<Body>
<Textarea Rows = 5 name = s1 cols = 27 id = "mytexTarea"> Propósito: insertar texto en el cursor detener en Textarea haciendo clic en el botón en la página </sextarea>
<input type = button onClick = "test ('Este es el texto que debe agregarse')" />
</body>
</html>
</span>