Ver Mensaje Individual
  #6 (permalink)  
Antiguo 20/06/2014, 06:39
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 2 meses
Puntos: 574
Respuesta: Abrir codigo html en nueva ventana

Escapalas

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2.  
  3. <p>Click the button to open a new window called "MsgWindow" with some text.</p>
  4.  
  5. <button onclick="myFunction()">Try it</button>
  6.  
  7. function myFunction() {
  8.     var myWindow = window.open("", "MsgWindow", "width=200, height=100");
  9.     var str = '<p>Aqui html con <span style="color:red">"comillas"</span> dobles<br />""""""""""""""muchas""""""""""""</p>';;
  10.     var res = str.replace('"', '\"');
  11.     myWindow.document.write(res);
  12. }
  13.  
  14. </body>
  15. </html>

uyy mas simple

Código Javascript:
Ver original
  1. function myFunction() {
  2.     var myWindow = window.open("", "MsgWindow", "width=200, height=100");
  3.     var str = '<p>Aqui html con <span style="color:red">"comillas"</span> dobles<br />""""""""""""""muchas""""""""""""</p>';
  4.     //var res = str.replace('"', '\"');
  5.     myWindow.document.write(str);
  6. }
__________________
Quim
--------------------------------------------------
Ayudar a ayudar es una buena práctica!!! Y da buenos resultados.

Última edición por quimfv; 20/06/2014 a las 06:45