
js如何利用窗口打印div元素的内容,下面web建站小编给大家详细介绍一下实现代码!
具体代码如下:
function printDiv() {
var divContents = document.getElementById("id").innerHTML;
var a = window.open('', '', 'height=500, width=500');
a.document.write('<html>');
a.document.write('<body ><h1>Welcome to the web site<br>');
a.document.write(divContents);
a.document.write('</body></html>');
a.document.close();
a.print();
}
JavaScript获取指定网站状态码查询代码(2种实现方法)
标签: 窗口打印
上面是“js如何利用窗口打印div元素的内容”的全面内容,想了解更多关于 js 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_3116.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

推荐一个专业优质(免费版权)的音乐配乐下载网站——Bensound
ADGuider官网:全球性的品牌/策划/营销/创意/文案 广告案例搜索
javascript关于数组中使用include方法
一款企业级AI智能体开发平台——智谱清流