Amigos, tengo el siguiente problema...
Tengo el siguiente codigo para usarlo como editor de texto:
Código HTML:
<html> <head> <script type="text/javascript"> var thisForm; function getMozSelection(txtarea) { var selLength = txtarea.textLength; var selStart = txtarea.selectionStart; var selEnd = txtarea.selectionEnd; if (selEnd==1 || selEnd==2) selEnd=selLength; return (txtarea.value).substring(selStart, selEnd); } function mozWrap(txtarea, lft, rgt) { var selLength = txtarea.textLength; var selStart = txtarea.selectionStart; var selEnd = txtarea.selectionEnd; if (selEnd==1 || selEnd==2) selEnd=selLength; var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + lft + s2 + rgt + s3; } function IEWrap(lft, rgt) { strSelection = document.selection.createRange().text; if (strSelection!="") { document.selection.createRange().text = lft + strSelection + rgt; } } function wrapSelection(txtarea, lft, rgt) { if (document.all) {IEWrap(lft, rgt);} else if (document.getElementById) {mozWrap(txtarea, lft, rgt);} } function mouseover(el) { el.className = "raise"; } function mouseout(el) { el.className = "buttons"; } function mousedown(el) { el.className = "press"; } function mouseup(el) { el.className = "raise"; } </script> </head> <body onload="thisForm=document.frmTest;"> <FORM ACTION="?mod=mensajes&zone=enviar" METHOD="post" id="frmTest" name="frmTest"> <table width="100%"> <tr> <td>Titulo: <input type="text" name="para" size="30" class="campos" maxlength="30"> </td> </tr> <tr> <td> <a href="#" onmouseover="mouseover(this);" onmouseout="mouseout(this);" onmousedown="mousedown(this);" onmouseup="mouseup(this);" onclick="wrapSelection(thisForm.T,'<i>','</i>');"><i>Italic</i></a> </tr> <tr> <td> Color: </td> </tr> <tr> <td colspan=2 align=center> <textarea rows="10" class="campos" name="T" style="width: 100%;"></textarea></td> </tr> <tr> <td align="center" colspan="2"><input name="T" type="reset" value="Restablecer" class="boton"> <input type=button value="Postiar" class=boton style="font-weight: bold;" onclick="enviarmensaje();"></td> </tr> </table> </FORM> </body> </html>
Consegui este script de: massless.org/mozedit/