开发者

Dynamic Iframe printing

开发者 https://www.devze.com 2023-01-04 05:00 出处:网络
开发者_如何学GoI want to dynamically set the content of an iframe to that of an html document I have.It is in the form of a string in memory in javascript.
开发者_如何学Go

I want to dynamically set the content of an iframe to that of an html document I have. It is in the form of a string in memory in javascript.

Then i want to print that iframe.

Ideas?


Yes.

var iframe = document.getElementByID("some ID");
iframe.contentDocument.write("HTML string");
iframe.contentWindow.print();
0

精彩评论

暂无评论...
验证码 换一张
取 消