Ver Mensaje Individual
  #6 (permalink)  
Antiguo 01/04/2009, 00:05
Avatar de Panino5001
Panino5001
Me alejo de Omelas
 
Fecha de Ingreso: mayo-2004
Ubicación: -34.637167,-58.462984
Mensajes: 5.148
Antigüedad: 20 años
Puntos: 834
Respuesta: Editor de texto JS-PHP

Fijate 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>test</title>
<script>    
function Init() {
    document.getElementById('iView').contentWindow.document.designMode = "on";

function HacerNegrita() {
    document.getElementById('iView').contentWindow.document.execCommand("bold", false, null);
    return false;

function HacerCursiva() {
    document.getElementById('iView').contentWindow.document.execCommand('italic', false, null);
    return false;

function valorizarOculto(){
    var edit=document.getElementById('iView').contentWindow.document || document.getElementById('iView').contentDocument;
    var valor=edit.body.innerHTML;  
    document.getElementById("valorframe").value=valor; 
    setTimeout(function(){alert(document.getElementById("valorframe").value);},300);
}
</script>  
</head>
<body onload="Init()"> 
<form action="?" method="post" onsubmit="valorizarOculto()">
<div>
<iframe id="iView"    name="iview" runat ="server" style="width: 400px; height: 250px; background-color:#CCFFFF; border: 2px" frameborder="1" enableviewstate="true" allowtransparency="true" ></iframe>
          <br />

      <img src="borrarbasura.jpg" onclick="HacerNegrita()" alt="negrita"/>
      <img src="actualizar.jpg" onclick="HacerCursiva()" alt="cursiva"/>

<input type="hidden" name="oculto" id="valorframe" /> 
  </div>
 <input name="enviar" type="submit" value="enviar" /> 
</form>
<?php  echo stripslashes($_POST['oculto']); ?>
</body>
</html>