Ver Mensaje Individual
  #5 (permalink)  
Antiguo 30/03/2002, 16:21
Avatar de Kaopectate
Kaopectate
Colaborador
 
Fecha de Ingreso: diciembre-2001
Ubicación: Curaçao (Antillas Holandesas)
Mensajes: 3.179
Antigüedad: 23 años, 2 meses
Puntos: 38
Re: Adjuntar imagenes a un textarea

christianc, te dejo este ejemplo burdo para que veas la idea. Supongo que sabrás mejorarlo.

Código:
<html>
 <head>
  <script language="javascript">
   function addSmile(){
    document.formulario.texto.value += "«smile»"
   }

   function showTxt(){
    var sText = document.formulario.texto.value;
    sText = sText.replace(/«smile»/ig, "<img src='smile.bmp'>");
    vWin = window.open();
    vWin.document.open();
    vWin.document.write("<html><head></head><body>" + sText + "</body></html>");
    vWin.document.close();
   }
  </script>
 </head>
 <body>
  <form name="formulario">
   <table width="200">
    <tr>
     <td colspan="2">
      <textarea name="texto" rows="5" cols="20"></textarea>
     </td>
    </tr>
    <tr>
     <td>
       <input type="button" name="bSmile" value="Smile" onclick="addSmile()">
     </td>
     <td>
       <input type="button" name="bShow" value="Mostrar" onclick="showTxt()">
     </td>
    </tr>
   </table>
  </form>
 </body>
</html>
Suerte.