Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/02/2012, 13:06
carolina3
 
Fecha de Ingreso: agosto-2011
Ubicación: barcelona
Mensajes: 237
Antigüedad: 12 años, 9 meses
Puntos: 1
Respuesta: pasar el valor de un div a un imput

ocp001a ya esta solucionado pero no se si funciona en todos los navegadores en google crome si aqui el codigo completo funcionando, gracias ahora abria que mejorar las funciones que pueda realizar mas cositas.




Código HTML:
Ver original
  1. <script language="javascript">
  2.  
  3. function setHidden()
  4. {
  5. var frameContent=textEditor.document.body.innerHTML;
  6. document.getElementById('titulo').value=frameContent;
  7. }
  8.  
  9. </head>
  10. <body onLoad="def()"><center>
  11. <div style="width:500px; text-align:left; margin-bottom:10px ">
  12. <input type="button" id="bold" style="height:21px; width:21px; font-weight:bold;" value="B" onClick="fontEdit('bold')" />
  13. <input type="button" id="italic" style="height:21px; width:21px; font-style:italic;" value="I" onClick="fontEdit('italic')" />
  14. <input type="button" id="underline" style="height:21px; width:21px; text-decoration:underline;" value="U" onClick="fontEdit('underline')" /> |
  15. <input type="button" style="height:21px; width:21px;"value="L" onClick="fontEdit('justifyleft')" title="align left" />
  16. <input type="button" style="height:21px; width:21px;"value="C" onClick="fontEdit('justifycenter')" title="center" />
  17. <input type="button" style="height:21px; width:21px;"value="R" onClick="fontEdit('justifyright')" title="align right" /> |
  18. <select id="fonts" onChange="fontEdit('fontname',this[this.selectedIndex].value)">
  19. <option value="Arial">Arial</option>
  20. <option value="Comic Sans MS">Comic Sans MS</option>
  21. <option value="Courier New">Courier New</option>
  22. <option value="Monotype Corsiva">Monotype</option>
  23. <option value="Tahoma">Tahoma</option>
  24. <option value="Times">Times</option>
  25. <select id="size" onChange="fontEdit('fontsize',this[this.selectedIndex].value)">
  26. <option value="1">1</option>
  27. <option value="2">2</option>
  28. <option value="3">3</option>
  29. <option value="4">4</option>
  30. <option value="5">5</option>
  31. <select id="color" onChange="fontEdit('ForeColor',this[this.selectedIndex].value)">
  32. <option value="black">-</option>
  33. <option style="color:red;" value="red">-</option>
  34. <option style="color:blue;" value="blue">-</option>
  35. <option style="color:green;" value="green">-</option>
  36. <option style="color:pink;" value="pink">-</option>
  37. </select> |
  38. <input type="button" style="height:21px; width:21px;"value="1" onClick="fontEdit('insertorderedlist')" title="Numbered List" />
  39. <input type="button" style="height:21px; width:21px;"value="â—" onClick="fontEdit('insertunorderedlist')" title="Bullets List" />
  40. <input type="button" style="height:21px; width:21px;"value="â†" onClick="fontEdit('outdent')" title="Outdent" />
  41. <input type="button" style="height:21px; width:21px;"value="→" onClick="fontEdit('indent')" title="Indent" />
  42. </div>
  43. <form action="acceso3.php" method="post" onsubmit="setHidden()">
  44.   <input type="hidden" name="titulo" id="titulo" />
  45. <input type="submit" value="submit" />
  46. </form>
  47. </center>
  48. <script type="text/javascript">
  49. <!--
  50. function def()
  51. {
  52. var testframe = document.createElement("iframe");
  53. testframe.name = testframe.id = "textEditor";
  54.  
  55.  
  56. if (testframe.addEventListener){
  57. testframe.addEventListener("load",function(e){this.contentWindow.document.designMode = "on";}, false);
  58. } else if (testframe.attachEvent){
  59. testframe.attachEvent("load", function(e){this.contentWindow.document.designMode = "on";});
  60. }
  61.  
  62. document.body.appendChild(testframe);
  63.  
  64. textEditor.document.designMode="on";
  65. textEditor.document.open();
  66. textEditor.document.write('<head><style type="text/css">body{ font-family:arial; font-size:13px; }</style> </head>');
  67. textEditor.document.close();
  68. textEditor.focus();
  69.  
  70.  
  71.  
  72. }
  73. function fontEdit(x,y)
  74. {
  75. textEditor.document.execCommand(x,"",y);
  76. textEditor.focus();
  77. }
  78. -->
  79. </body>
  80. </html>

gracias