【发布时间】:2012-03-12 18:31:27
【问题描述】:
如何将整个 div 复制到弹出窗口?
我想做什么:
function ImprimirTela() {
var text = "<html>\n<head>\n<title>Impressão Guia</title>\n";
text += "<script src='~/js/jquery-1.4.2.js' type='text/javascript' language='javascript' />\n";
text += "</head>\n<body>\n";
text += "<input type='button' value='Imprimir esta página' onclick='window.print();' style='float: right' />\n";
text += "<div id='conteudo'>\n";
text += $("#divDadosBasicos").html($(querySelector).html());
text += $("#divHipotesesDiagnosticas").html($(querySelector).html());
text += "</div>\n/body>\n</html>";
var newWindow = window.open('', 'Impressao', 'width=900,height=700');
newWindow.document.write(text);
}
我不知道这是否是更好的方法。如果您认为/知道更简单的方法,请分享
提前致谢!
【问题讨论】:
-
你在哪里尝试这个,JSfiddle ?
-
不,VisualStudio (asp.Net + C# + Javascript)。
标签: javascript jquery popup copy