Código HTML:
<SCRIPT language="Javascript" type="text/javascript"> function storeCaret(text) { if (text.createTextRange) { text.caretPos = document.selection.createRange().duplicate(); } } function meter(text) { var form1 = document.Form1.texto; if (form1.createTextRange && form1.caretPos) { var caretPos = form1.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text; } else form1.value += text; form1.focus(caretPos) } function codigo(accion) { switch(accion) { case "url": url = prompt("URL de el Enlace", "http://"); if(url) { url="<a>"+url+"</a>"; meter(url); } break; case "bold": negras = prompt("Texto en Negritas", ""); if(negras) { negras="<b>"+negras+"</b>"; meter(negras); } break; case "italics": italics = prompt("Texto en Italicas", ""); if(italics) { italics="<i>"+italics+"</i>"; meter(italics); } break; default: meter(accion); break; } } function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit); else countfield.value = maxlimit - field.value.length; } </script>