Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/12/2014, 07:10
Anarko
 
Fecha de Ingreso: febrero-2004
Mensajes: 1.987
Antigüedad: 21 años
Puntos: 22
Respuesta: ¿cómo envío el contenido de un formulario? (method="post" action="file.php

Eureka!!!

Ha sido excelente tu ayuda linda Isabel.

Yo te agradézco si me explicas por que mi
Código:
unsubmit="document.forms.formimg.cm.value=document.getElementById('editor').innerHTML;"
no funcionó nunca, pero al reemplazarlo por el tuyo:
Código:
unsubmit="document.forms.formimg.cm.value=editor.body.innerHTML;"
vá de maravilla...

Yo solo veo la diferencia en las lineas escritas, pero desconózco la diferncia "de fondo" entre la primer línea (la habitual, 'típica'), y la que tu estas utilizando (HTML5 créo).

Puedes enseñarme un póco + plis?

Salu2!

Al final mi código ha quedado así:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>[img Form]</title><style>
input{
border:1px solid #000;
background:#CCCCCC;
font-family:VerdanaArialHelveticasans-serif;
font-size:9px;
margin-bottom:3px;
}
</
style>
<
script>
var 
editor;
function $(
id){
    return 
document.getElementById(id);
}
function 
rev(t)    {
    return 
t.split("<").join("&lt;").split(">").join("&gt;").split("\"").join("&quot;");
}
function 
insertarImagen(){
    var 
u;
    if(!(
u=prompt('ingresar url','http://')))return;
    
editor.execCommand("InsertImage",false,u);
}
function 
htmlOEditor(e){
e=|| window.event;
ob=e.target || e.srcElement
$('edit').style.display=(ob.value=='html')?'none':'block';
$(
'ht').style.display=(ob.value!='html')?'none':'block';
$(
'ht').innerHTML=rev(editor.body.innerHTML);
ob.value=(ob.value=='html')?'editor':'html';
}
window.onload=function(){
    
editor=$('edit').contentDocument || $('edit').contentWindow.document;
    
editor.designMode='on';
}
</script></head><body><form id="formimg" method="post" action="http://127.0.0.1/file.php" target="_blank" onsubmit="document.forms.formimg.cm.value=editor.body.innerHTML;"><input type="button" value="imagen" onclick="insertarImagen();" /><iframe id="edit" width="100%" height="300" style="border:1px solid #000;">eee</iframe><div id="ht" style="width:100%; height:300px; overflow:auto; border:1px solid #000; display:none">hhh</div><div style="margin-top:3px;"><input type="button" onclick="htmlOEditor(event);" value="html" /> <input type="submit" /></div><textarea id="cm" name="cuerpo"></textarea></form></body></html>