【发布时间】:2021-08-31 10:24:06
【问题描述】:
我在 javascript 中使用打印功能,并且在数据顶部的打印屏幕中它显示 url 即本地主机和页脚我想将页眉和页脚更改为其他东西一个徽标和一些标题怎么能我这样做我正在打印一个表格,这是用于打印的函数的代码
document.getElementById("btnPrint").onclick = function() {
printElement(document.getElementById("myTable"));
}
function printElement(elem) {
var domClone = elem.cloneNode(true);
var $printSection = document.getElementById("printSection");
if (!$printSection) {
var $printSection = document.createElement("div");
$printSection.id = "printSection";
document.body.appendChild($printSection);
}
$printSection.innerHTML = "";
$printSection.appendChild(domClone);
window.print();
}
如果有人能帮我修改页眉和页脚,那就太好了
【问题讨论】:
标签: javascript html css printing