使用Javascript打印没有URL和DateTime的页面

Anv*_*esh 1 javascript vb.net asp.net

我想通过javascript使用以下代码打印div标签内容.

var divToPrint1 = $('#PrintDoc').html();
var newWin = window.open('Share Certificate #001', '', 'width=10px,height=10px');
newWin.document.open();
newWin.document.write('<html><body onload="window.print();">' + divToPrint1 + '</body></html>');
newWin.document.close();
setTimeout(function () { newWin.close(); }, 10);
Run Code Online (Sandbox Code Playgroud)

打印代码工作正常.但现在我想使用javascript代码从打印中删除网址,日期和标题.可能吗?任何人都可以帮我解决以下问题吗?

Mat*_*all 5

您无法以编程方式删除URL和时间戳.这些选项是Print对话框的一部分,无法通过页面中的JavaScript控制这些选项.这种选择完全取决于用户.