volver a renderizar html en un div en una nueva ventana del navegador

I would like to take all my <div>'s in a parent <div> and re-render the contents into a new broswer window. Can anyone make any suggestions? I'm using jQuery and .NET.

  1. Get all divs in the markup.

    var markupData = $("#names").html();
  2. Empty div.

  3. open new window displaying markupData.


preguntado el 30 de agosto de 11 a las 22:08

Perhaps you can explain the purpose of this exercise... we might have additional insights. -

2 Respuestas

Qué tal si:

var html = $("#names").html();
var my_window = window.open("", "mywindow1", "width=350,height=150");


Usar window.open. Keep a reference to the window you just created and set its HTML.

Ejemplo: http://jsfiddle.net/A72TH/

If you wanted to append a stylesheet containing CSS rules for the blank page, you could write something like this:

    .append("<link rel='stylesheet' href='styles.css' />");

Respondido 31 ago 11, 05:08

@MdeVera: No problem! See my updated answer if you want to append a link elemento en el head of the blank popup page. - Andrew Whitaker

Sounds like you want to make an instance of a new window and then write to it with your data. Here is a helpful link for that:


Respondido 31 ago 11, 03:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.