Foros del Web » Programando para Internet » PHP »

recoger el texto de un iframe

Estas en el tema de recoger el texto de un iframe en el foro de PHP en Foros del Web. Hola no sabia muy bien que titulo ponerle, bueno el caso es que encontré un script para crear un editor de texto pero no se ...
  #1 (permalink)  
Antiguo 28/02/2012, 15:23
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 8 meses
Puntos: 1
recoger el texto de un iframe

Hola no sabia muy bien que titulo ponerle, bueno el caso es que encontré un script para crear un editor de texto pero no se como pasar el resultado a la base de datos ya que el texto se genera en una etiqueta <iframe>, el código es el siguiente:

Código HTML:
Ver original
  1. </head>
  2. <body onLoad="def()"><center>
  3. <div style="width:500px; text-align:left; margin-bottom:10px ">
  4.  
  5.  
  6. <input type="button" id="bold" style="height:21px; width:21px; font-weight:bold;" value="B" onClick="fontEdit('bold')" />
  7. <input type="button" id="italic" style="height:21px; width:21px; font-style:italic;" value="I" onClick="fontEdit('italic')" />
  8. <input type="button" id="underline" style="height:21px; width:21px; text-decoration:underline;" value="U" onClick="fontEdit('underline')" /> |
  9. <input type="button" style="height:21px; width:21px;"value="L" onClick="fontEdit('justifyleft')" title="align left" />
  10. <input type="button" style="height:21px; width:21px;"value="C" onClick="fontEdit('justifycenter')" title="center" />
  11. <input type="button" style="height:21px; width:21px;"value="R" onClick="fontEdit('justifyright')" title="align right" /> |
  12. <select id="fonts" onChange="fontEdit('fontname',this[this.selectedIndex].value)">
  13.    <option value="Arial">Arial</option>
  14.    <option value="Comic Sans MS">Comic Sans MS</option>
  15.    <option value="Courier New">Courier New</option>
  16.    <option value="Monotype Corsiva">Monotype</option>
  17.    <option value="Tahoma">Tahoma</option>
  18.    <option value="Times">Times</option>
  19. <select id="size" onChange="fontEdit('fontsize',this[this.selectedIndex].value)">
  20.    <option value="1">1</option>
  21.    <option value="2">2</option>
  22.    <option value="3">3</option>
  23.    <option value="4">4</option>
  24.    <option value="5">5</option>
  25. <select id="color" onChange="fontEdit('ForeColor',this[this.selectedIndex].value)">
  26.    <option value="black">-</option>
  27.    <option style="color:red;" value="red">-</option>
  28.    <option style="color:blue;" value="blue">-</option>
  29.    <option style="color:green;" value="green">-</option>
  30.    <option style="color:pink;" value="pink">-</option>
  31. </select> |
  32. <input type="button" style="height:21px; width:21px;"value="1" onClick="fontEdit('insertorderedlist')" title="Numbered List" />
  33. <input type="button" style="height:21px; width:21px;"value="●" onClick="fontEdit('insertunorderedlist')" title="Bullets List" />
  34. <input type="button" style="height:21px; width:21px;"value="←" onClick="fontEdit('outdent')" title="Outdent" />
  35. <input type="button" style="height:21px; width:21px;"value="→" onClick="fontEdit('indent')" title="Indent" />
  36. </div>
  37. <iframe id="textEditor" style="width:500px; height:170px;">
  38. </center>
  39.  
  40. <script type="text/javascript">
  41. <!--
  42. textEditor.document.designMode="on";
  43. textEditor.document.open();
  44. textEditor.document.write('<head><style type="text/css">body{ font-family:arial; font-size:13px; }</style> </head>');
  45. textEditor.document.close();
  46. function def()
  47. {
  48.   document.getElementById("fonts").selectedIndex=0;
  49.   document.getElementById("size").selectedIndex=1;
  50.   document.getElementById("color").selectedIndex=0;
  51. }
  52. function fontEdit(x,y)
  53. {
  54.   textEditor.document.execCommand(x,"",y);
  55.   textEditor.focus();
  56. }
  57. -->
  58.  
  59. </body>
  60. </html>

si alguien me puede indicar mas o menos como hacerlo se lo agradecería la verdad
  #2 (permalink)  
Antiguo 28/02/2012, 15:25
Colaborador
 
Fecha de Ingreso: mayo-2008
Ubicación: $MX['VZ']['Xalapa']
Mensajes: 3.005
Antigüedad: 15 años, 11 meses
Puntos: 528
Respuesta: recoger el texto de un iframe

Lo que tienes que hacer es con javascript, al momento de guardar, pasar el contenido del iframe a un campo del formulario que lo procesará y pasará a la BD.
  #3 (permalink)  
Antiguo 28/02/2012, 15:30
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 8 meses
Puntos: 1
Respuesta: recoger el texto de un iframe

vale no se javascript, pero bueno por lo menos se por donde tirar gracias ocp001a

Etiquetas: html, iframe, recoger
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:49.