Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/08/2004, 07:41
amdforever2
 
Fecha de Ingreso: junio-2004
Mensajes: 11
Antigüedad: 19 años, 9 meses
Puntos: 0
Leer el html de un IFrame

Buenas a todo el mundo.

Estoy tratando de incluir en mi aplicacion un mini-editor de texto wysiwyg (creo que se escribe así) realizado en javascript (creo que lo pillé de http://www.javascripts.astalaweb.com).

El caso es que hasta ahora tenia uno puesto que no era wysiwyg, y que funciona mediante un textarea. Funcionaba bastante bien, pero el nuevo editor que trato de meter, utiliza como interfaz con el usuario un iframe.

Mi pregunta es saber de que modo puedo con php leer el contenido (el html) de ese iframe (si es que se puede).

Gracias.

P.D: pongo el script del editor, el iframe está al final.

<html>
<head>
<style type='text/css'>
TABLE#window{ background-color:threedface; padding:1px; color:menutext; border-width:1px; border-style:solid; border-color:threedhighlight threedshadow threedshadow threedhighlight; }
TABLE#toolBar0{ background-color:threedface; padding:1px; color:menutext; border-width:1px; border-style:solid; border-color:threedhighlight threedshadow threedshadow threedhighlight; }
</style>

<script language="JavaScript">
function eButton(cmdButton, buttonval)
{
if (buttonval == "over")
{
cmdButton.style.backgroundColor = "threedhighlight";
cmdButton.style.borderColor = "threeddarkshadow threeddarkshadow threeddarkshadow threeddarkshadow";
}

else
if (buttonval == "out")
{
cmdButton.style.backgroundColor = "threedface";
cmdButton.style.borderColor = "threedface";
}

else
if (buttonval == "down")
{
cmdButton.style.backgroundColor = "threedlightshadow";
cmdButton.style.borderColor = "threedshadow threedshadow threedshadow threedshadow";
}

else
if (buttonval == "up")
{
cmdButton.style.backgroundColor = "threedhighlight";
cmdButton.style.borderColor = "threedshadow threedshadow threedshadow threedshadow";
cmdButton = null;
}

else return;
}

function foreColor()
{
var fColor = showModalDialog("color.htm","","dialogWidth:140px; dialogHeight:120px" );

if (fColor != null)
{
editbox.document.execCommand("ForeColor", false, fColor);
}

editbox.focus();
}
</script>
</head>

<body onload=editbox.document.designMode="On">
<table id="window" align='center' border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse; border: 1px solid #C0C0C0'>
<tr8>
<td>
<table id="toolBar0" cellpadding='0' cellspacing='0'>
<tr valign="middle">
<td>
<div onClick="editbox.document.execCommand('cut', false, null); editbox.focus();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="1" vspace=1 align=absmiddle src="images/cut.gif" alt="Cortar">
</div>
</td>

<td>
<div onClick="editbox.document.execCommand('copy', false, null); editbox.focus();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="1" vspace=1 align=absmiddle src="images/copy.gif" alt="Copiar">
</div>
</td>

<td>
<div onClick="editbox.document.execCommand('paste', false, null); editbox.focus();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="1" vspace=1 align=absmiddle src="images/paste.gif" alt="Pegar">
</div>
</td>

<td id="lineCtrl">
<div onClick="editbox.document.execCommand('InsertHoriz ontalRule', false, null); editbox.focus();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="2" vspace=1 align=absmiddle src="images/line.gif" alt="Insertar Linea Separadora">
</div>
</td>

<td id="forecolorCtrl">
<div onClick="foreColor();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="2" vspace=1 align=absmiddle src="images/fgcolor.gif" alt="Color del Texto">
</div>
</td>

<td>&nbsp;
<select onchange="editbox.document.execCommand('fontname', false, this[this.selectedIndex].value); editbox.focus();">
<option selected>Fuentes</option>
<option value="Arial">Arial</option>
<option value="Arial Black">Arial Black</option>
<option value="Arial Narrow">Arial Narrow</option>
<option value="Courier New">Courier New</option>
<option value="System">System</option>
<option value="Tahoma">Tahoma</option>
<option value="Times New Roman">Times NR</option>
<option value="Verdana">Verdana</option>
<option value="Wingdings">Wingdings</option>
</select>
</td>

<td>&nbsp;
<select onchange="editbox.document.execCommand('fontsize', false, this[this.selectedIndex].value); editbox.focus();">
<option selected>Tamaño</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="10">10</option>
<option value="12">12</option>
<option value="14">14</option>
</select>&nbsp;&nbsp;
</td>

<td>
<div onClick="editbox.document.execCommand('bold', false, null); editbox.focus();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="1" vspace=1 align=absmiddle src="images/bold.gif" alt="Negrita">
</div>
</td>

<td>
<div onClick="editbox.document.execCommand('italic', false, null); editbox.focus();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="1" vspace=1 align=absmiddle src="images/italic.gif" alt="Cursiva">
</div>
</td>

<td>
<div onClick="editbox.document.execCommand('underline', false, null); editbox.focus();" onmouseover="eButton(this, 'over');" onmouseout="eButton(this, 'out');" onmousedown="eButton(this, 'down');" onmouseup="eButton(this, 'up');">
<img hspace="1" vspace=1 align=absmiddle src="images/under.gif" alt="Subrayado">
</div>
</td>
</tr>
</table>
</td>
</tr>

<tr>
<td>
<iframe width='100%' id='editbox' height='100'></iframe>
</td>
</tr>
</table>
</body>
</html>